say I have
char * name ;
how do I print this name?
I tried
fprintf(stderr, "%s\n", name);
but it gives me segmentation fault
Printable View
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.
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.