What we can write between this : int main(HERE) in C language | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What we can write between this : int main(HERE) in C language

I actually ask google but i don't find a clear answer

27th Sep 2019, 1:47 PM
Yahya LAZREK
Yahya LAZREK - avatar
1 Answer
+ 2
main accepts 0 or 2 arguments int main() // unspecified amount of args int main(void) // no args int main(int argc, char** argv) // argc is the number of arguments from the command line, argv is an array (or vector since it differs when you run main with different amount of cmd line arguments) of c-style strings which are the file name + command line arguments and will have the length of argc int main(int argc, char* argv[]) // the same as the one before but I like it better because it tells me that argv is an array of char* I believe you can make either of them const but there's no reason to...
27th Sep 2019, 2:05 PM
jtrh
jtrh - avatar