main:entry point of C program

Table of Contents

In C, the entry point is the main function int main(){}.

#include <stdio.h>
int main(int argc, char args *argv[]){
}
argc
number of arguments, including path to binary
argv
array of strings, each being a argument seperated with space

After being compiled to binary e.g. /tmp/a.out, calling /tmp/a.out 3 2 my -i execute main with:

Backlinks

Author: Linfeng He

Created: 2024-04-03 Wed 20:17