Hi,

Can anyone explain the below outputs of the program (with malloc statement and without malloc statement).

#include<stdio.h>
#include<stdlib.h>
int main()
{
char *p;

p = (char *) malloc(10);
printf("%d\n", p);
printf("%d\n", *p);
printf("%d\n", sizeof(p));
printf("%d\n", sizeof(*p));
printf("%d\n", sizeof(&p));

return 0;
}

The outputs I got (using gcc 4.5 on linux):

without malloc:
----------------
madhu@Ideapad:~/Desktop$ ./a.out
-1217282060
124
4
1
4

With malloc:
---------------
madhu@Ideapad:~/Desktop$ ./a.out
138657800
0
4
1
4


Thanks in advance!