×

Loading...

In my opinion, 1 wrong. 2 wrong. 3 wrong.

1 , The pointer P you defined in the function is a local variable , so it will return NULL. in this case.
2. The same as number 1.
3. The function needs you return pointer , but you give it a string value.
The solutions is either:
char* v(char* p)
{
char p[] = " result of function v()";
return p;
} This one is better
or
char* v()
{
static p[]="result of function v()";
return p;
} It is ok.
Report

Replies, comments and Discussions: