say I have
char * name ;
how do I print this name?
I tried
fprintf(stderr, "%s\n", name);
but it gives me segmentation fault
say I have
char * name ;
how do I print this name?
I tried
fprintf(stderr, "%s\n", name);
but it gives me segmentation fault
What name? It looks like all you have is a pointer to char that is uninitialised.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
That's how you would print it, assuming the pointer name actually points to a string. Since it segfaulted, I'm guessing it pointed to New Jersey instead.