I'm currently following along with the Big Nerd Ranch's Objective-C guide, and one of the examples is as follows:
int main(int argc, const char * argv[])
{
int i = 17;
printf("i stores its value at %p\n", &i); return 0;
}
// output => i stores its value at 0xbffff738
int main(int argc, const char * argv[])
{
int i = 17;
printf("i stores its value at %p\n", &i);
printf("this function starts at %p\n", main); return 0;
}
// output => i stores its value at 0xbffff738
// this function starts at 0x100000ed0
I tried using the "&" symbol in front of main, and I get the same result- 0x100000ed0. But when I remove the ampersand from in front of "i", I see only 0x11 instead of 0xbffff738.
Question- why the difference? And why does one work with or without an ampersand, while the other seems to require it in order to produce the expected output?