make026 wrote: | ||
---|---|---|
Does the compiler allocate a memory address for p on line 6? What is the action offically called for a pointer to a pointer on line 11? Does the compiler allocate a memory address for p on line 11? |
int * ptr;
would be like getting a cards and giving it the title ptr. This card may already have some information filled it from the last time it was used, so it would not be good to use it as it is. This is uninitialised.int * ptr =NULL;
would be the same as a move only your erase any information on the card. It still will not help you find the book but at least you know that it will not. This is initialising to a NULL pointer constant.int * ptr = &an_int;
, So here would be like, you have a book called an_int in the library. You get a card. call it ptr and fill in the location information. Again, this is initialisation. This location information is written on the card before it is put into use. ptr = &an_int2;
, This is assignment, You are wringing new information on a card that is in use.