Do every variable declared as pointer have to allocate memory?

Viewed 6905

Well, I am new to C. I would like to know as my title says.

Suppose I declare pointers as following,

char *chptr1;
char **chptr2;
int *i;
int **ii;
struct somestruct *structvar1;
struct somestruct **structvar2;

Then,

  1. Do I need to allocate memory for every variable, before storing data into them?
  2. Is there any special case when I do not need to allocate memory for them? for this I know one for char pointer, strdup() which allocate memory itself, we have not to care much about it.
  3. Any further suggestions are welcome.
4 Answers
Related