#include <iostream>
using namespace std;
void myfunc(char* char_in)
{
bool empty = true;
for(int i = 0; char_in[i]; ++i)
{
if(char_in[i] != ' ' && char_in[i] != '\t' && char_in[i] != '\r' && char_in[i] != '\n')
{
printf("Char* is not empty. Found a non space character @ %d\n\n", i);
empty = false;
break;
}
}
if(empty)
{
printf("Char* is empty\n\n");
}
}
int main()
{
char* char_i = " Hello ";
myfunc(char_i);
system("PAUSE");
return 0;
}
Tuesday, January 22, 2013
Parse all characters in char*
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment