I'm trying to understand pointer variables. I have the following sample program:
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
int main(void)
{
char v2 = 'a';
char* p2 = &v2;
printf("The value of v2 is %c\n", v2);
printf("The address of v2 is %s\n", &v2);
printf("The address of v2 is %s\n", p2);
return 0;
}
It compiles and runs just fine. However, it says that v2='a', which is true, but also that the address where v2 is stored is simply 'a'. I tried two ways (using &v2 and declaring another pointer variable). I'm not sure what I'm doing wrong... is it that you can't print out the address of the variable because it's not really a value? Thanks!