Click for Table of Contents
The C Primer
Book and Reference Collection
Copyright © 2024 by Rance D. Necaise
Table Of Contents
The C Primer
Copyright © 2024
Rance D. Necaise

1.1 Your First C Program

All programs must have a starting point for execution, which varies from language to language. In Python, this is the first statement encountered outside of all functions and classes. In C, every program must have a main function. The first statement executed is the first statement within the main function. Consider the basic "Hello World" program below written in C:

/* hello.cc
   The hello world program in C.
 */


#include <stdio.h>

int main()
{
  printf("Hello World!\n");
}

The main function will be called automatically when the program is executed. Thus, you never call this function directly within your program.

Page last modified on February 10, 2024, at 03:02 PM