-
pulling strings
i'll admit it. i dont have a clue about strings. there. its out.
imagine this code: (i dont have to. im looking at it now)
char string[10] = "hi";
printf("%s", string);
i realize that doesnt work for some reason, but i havent the slightest why.
any help?
btw, it gives me a " 'string' undeclared " error.... i declared it, right?
-
char string[10] = "hi";
printf("%s", &string);
-
didnt help...
here is a better approximation of my code:
if ( //something )
char string[] = "hi";
if ( //something else )
char string[] = "bye";
printf("%s", string); //(or &string... same error)
-
oops sorry hehe, its either:
char string[10] = "hi";
printf("%s", &string[10]);
or
char string[10] = "hi";
printf("%s", string[10]);
-
*erased*
woo! figured it out