BCA / B.Tech 9 min read

First Program in C

First Program in C:


The C language is considered a significant milestone in the field of programming. The first program in C usually starts with the "Hello, World!" program. This program is the simplest and most initial example for understanding the basic structure and syntax of the C language.

Basic Structure of a C Program:
A C program primarily consists of a Preprocessor Directive (like `#include`), the `main()` function, variable declarations, statements, and a return statement.

The First C Program – "Hello, World!":
The document provides the classic "Hello, World!" program code and explains each part in detail: `#include ` for input/output functions, `int main()` as the program's starting point, `printf()` to print to the screen, and `return 0;` to indicate successful execution.

Steps to Run a C Program:
The steps include writing the program in a text editor, saving it with a `.c` extension, compiling it using a compiler like GCC, and then executing the compiled file.

Advantages and Disadvantages of the First Program:
Advantages: Understanding basic syntax, input-output operations, foundation of programming, and the compile/execute process.
Disadvantages: Limited functionality, not for real-life use, and no user input.