The First C Program

I will assume that you are using Linux and gcc compiler for coding. The commands may differ if you are using any other type of compiler or operating system. You can explore the link for further exploration.

Operating system used : Ubuntu 20.04 LTS

Compiler used : gcc version 10.2.1

Explanation of each line of code

  • The first line of the program is #include<stdio.h> which is a header file. It includes the standard input-output library, which contains definitions of functions like printf.
  • The main function is the entry point of the program.
  • printf is used to print the message "Hello, World!" to the console.
  • The \n is the escape sequence for a newline character, which moves the cursor to the beginning of the next line.
  • The main function should return an integer (0 indicates successful execution).
  • { } and ; are essential part of C syntax.

How to write a program and compile

  • Any editor can be used to create a C Code file. (N.B : C code and C program are two different things they are used i)

a