I'm not 100% sure if what I'm writing is the problem or if the problem is elsewhere. I am given this '**string;' which, of course points to a string. I need to print this string. I'm simply doing printf("%s",str ing) and every combination with '*' thereof but not getting the expected string to print (either garbage or a fault). What am I forgetting?
Printing pointer to pointer to a string
Collapse
X
-
Tags: None
-
Hmm. Might be something else is the problem. I looked at the assembly language and what I originally tried seems to be working:
printf("%s",**s tring);
The function that is giving me **string is declared as
'char** getstring(void) ;'
and I am doing this:
[code=c]
char** string;
char** getstring(void) ;
string=getstrin g();
printf("%s",**s tring);
[/code] -
-
Nope. A char* might point to a C string. char * array like char *string[] could also be expressed as char**. You have an array of strings on hand. Might want to take a closer look at the code that is involved.I am given this '**string;' which, of course points to a stringComment
-
Can we all say "Arrrrghhh! "
In my print routine, I wasn't checking for when there was no string. The way it would fail made me think it was problems with my pointer scheme.Comment
Comment