Hi all,
I've been getting back into the basics of C, and I'm remembering a lot more than I thought I would (the last time I had a class in C was around 10 years ago.)
All of the simple programs I'm writing at the moment are just that - simple, and only require a main() function that looks like this:
I know that you can pass arguments inside the parentheses, but I don't understand much about it yet.
I'm currently writing code in an editor in Terminal and using gcc to compile. When I go through Xcode, it sets up this code for me:
I know that the 'int' in front of main is generally optional, because main assumes int as its type.
But my question is...what the heck is all that other stuff in there, and why does Xcode just assume that I need it?
Thanks,
-Bryan
I've been getting back into the basics of C, and I'm remembering a lot more than I thought I would (the last time I had a class in C was around 10 years ago.)
All of the simple programs I'm writing at the moment are just that - simple, and only require a main() function that looks like this:
Code:
main()
{
// code goes here
}
I know that you can pass arguments inside the parentheses, but I don't understand much about it yet.
I'm currently writing code in an editor in Terminal and using gcc to compile. When I go through Xcode, it sets up this code for me:
Code:
int main (int argc, const char * argv[])
{
// Code goes here
}
I know that the 'int' in front of main is generally optional, because main assumes int as its type.
But my question is...what the heck is all that other stuff in there, and why does Xcode just assume that I need it?
Thanks,
-Bryan