Apps
main
[int] main([ int argc, char *argv[] ]) {
...
return 0;
}
- Every C program must have a "main"
function in one of the .c
files.
Example
#include <stdio.h>
main() {
printf("Hello, world!\n");
return 0;
}
Compiling and running
g++
g++ [-o EXE-FILE] MAIN-FILE [SUB-FILE]*
- By default, "a.out" is used for the
executable file.
Examples
g++ main.cpp
g++ -o run main.cpp node.cpp
...
return 0;
}
main() {
printf("Hello, world!\n");
return 0;
}