From my understanding, pName
should be a pointer with the value of the memory location of the char name
.
Which means, when I dereference the pointer variable pName
in the second printf
statement, it should just print the string of characters "Cameron". BUT IT DOESNT! Could someone help this noob out :)?
#include <stdio.h>
#include <stdlib.h>
int main()
{
char name[] = "Cameron";
char * pName = &name;
printf("Printing string of characters: %s\n", name);
printf("Dereferencing pointer and printing string: %s\n", *pName);
printf("Printing pointer: %p\n", &name);
printf("Printing pointer another way %p\n", pName);
return 0;
}