Search notes:

C

main

#include <stdio.h>

int main(int argc, char ** argv, char **envp) {

    printf("argc = %d\n", argc);

 //
 // Show arguments given to the program.
 // argv[0] is the name of the program itself.
 //
    for (int arg=0; arg<argc; arg++) {
        printf("argv[%d] = %s\n", arg, argv[arg]);
    }

 //
 // Show environment variables:
 //
    char* envv;
    while (envv = *envp++) {
        printf("%s\n", envv);
    }

    return 0;
}
Github repository about-c, path: /main.c

gnu C option summary

https://gcc.gnu.org/onlinedocs/gcc-6-1.0/gcc/Option-Summary.html

Statements

Two types of statements:
Simple statements:
Compound statements:

TODO

--print-file-name

gcc --print-file-name=include
gcc --print-file-name=include/stddef.h

gcc --print-file-name=crtbegin.o
gcc --print-file-name=crtend.o

Hosted vs freestanding

freestanding is just the language (without libraries etc.). A hosted environment comes with the the standard library.
When compiling for a hosted environment, the macro __STDC_HOSTED__ is defined.

See also

_Generic
datatypes
C / C++
C standards
Memory allocation

Index