Interview Questions

I am trying to declare a pointer and allocate some space for it

C Interview Questions and Answers


(Continued from previous question...)

I am trying to declare a pointer and allocate some space for it

I'm trying to declare a pointer and allocate some space for it, but it's not working. What's wrong with this code?

char *p;
*p = malloc(10);

The pointer you declared is p, not *p.

(Continued on next question...)

Other Interview Questions