C Programming Language Tutorial

Variables and Data Types

Input/Output

Looping and Selection Structures

Array

Functions

Preprocessing Command

Pointer

Structure

File Operations

Important Knowledge

The First Program for C Programming Language

The first program usually written in the C programming language is the "Hello, World!" program. This program simply outputs the text "Hello, World!" to the screen.

Here's an example of how to write the "Hello, World!" program in C:

#include <stdio.h>

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

In this example, we use the printf function to output the string "Hello, World!" to the screen. The \n at the end of the string represents a newline character, which adds a new line after the text is output.

The main function is a special function in the C programming language that is the entry point of a C program. When the program is run, the main function is executed first.

The return statement at the end of the main function indicates the exit status of the program. A return value of 0 indicates that the program ran successfully, while a non-zero value indicates an error or abnormal termination.

When the program is compiled and run, the output should be:

Hello, World!

This simple program serves as a basic introduction to the syntax and structure of a C program, and is often used as a starting point for learning the C programming language.