Hi, I am a freshman computer engineering student and I've just started programming in C, it may seem a bit simple but I couldn't find the answer of my question. Here is the code I write:
Code:
#include <stdio.h>
int main()
{
int i=1, j, *ip;
ip = &i;
printf("%d\n", ip);
return 0;
}
When I compile and run this code it gives me warning and prints random numbers like :
-1079398400 or -1077595728 or -1080068272
and when i change the code tho this :
Code:
#include <stdio.h>
int main()
{
int i=1, j, *ip;
ip = &i;
printf("%p\n", ip);
return 0;
}
it prints these (that I think they are adresses ) : 0xbfa20780 or 0xbfc0e170 or 0xbfaf6850
Can you tell me why do I get these negative numbers and why do they change each time i run the code, and also what is the difference between these two codes?
Thanks a lot
bahada