Necessity of "&"


#1

Hey everyone, love the book and learning a ton. I was wondering, in this example from the book, why doesn’t “main” in the second printf() block need an ampersand before it? Shouldn’t it have to be &main just like i has to be &i ?

Thanks!

[code]#include <stdio.h>

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;

}[/code]


#2

Actually I tried it out of curiosity and nothing changed. The ampersand operator still gave the address. I guess you could place it there if you’d like but if you get into this habit, it might carry over elsewhere making your programs less efficient. That’s my best guess. Don’t worry, chapters 9-12 are challenging.


#3

My understanding is that since you are calling for the FUNCTION (main) you do not need the & symbol, however if you are calling a certain variable within a function (ex. int i = 17) you need the & symbol “&i”.