hello guys,
i have been thinking of my college project work given to me. where in one sutitation i was suppose to check where a structure is empty are not. for instance
is there any way that i can check that.Code:struct something { int something1; int something2[20]; }; int main() { struct something some[10]; if(how do i check that some[1] struct variable is empty) }
i got one more thing to be clarified about strtok fucntion, lets take an example
if u look at that code the first call to function strtok is with the orginal string 'str' and with the second call i am sending the update pointer NULL as a parameter. and at the end i wanted to print the original string of 'str'. but after using strtok my original string is changed which just contains the first word. is there any way that i can get back that string. well i thought of one way that's copy the original string to some other string before the sending the orginal string to strtok.Code:#include <stdio.h> #include <string.h> int main() { char str[]= {"This is a test string"}; char *p; p=strtok(str," "); while(p != NULL) { printf("Token : %s\n",p); p=strtok(NULL," "); } printf("The original string \" %s \"",str); getchar(); return 0; } /*my ouput Token : This Token : is Token : a Token : test Token : string The original string " This " */
well, it might me simple thing which might have confused me a lot, can any one explain this please
ssharish2005



LinkBack URL
About LinkBacks


