Beginning with C Programming

Writing the First Program in C

The following code is one of the simplest C programs that will help us the basic syntax structure of a C program.

Example:

C
#include <stdio.h>

int main() {
  int a = 10;
  printf("%d", a);
  
  return 0;  
}

Output
10

Let us analyze the structure of our program line by line.

Structure of the C program

After the above discussion, we can formally assess the structure of a C program. By structure, it is meant that any program can be written in this structure only. Writing a C program in any other structure will hence lead to a Compilation Error. The structure of a C program is as follows:

C Language Introduction

C is a procedural programming language initially developed by Dennis Ritchie in the year 1972 at Bell Laboratories of AT&T Labs. It was mainly developed as a system programming language to write the UNIX operating system.


The main features of the C language include:

  • General Purpose and Portable
  • Low-level Memory Access
  • Fast Speed
  • Clean Syntax

These features make the C language suitable for system programming like an operating system or compiler development.

Similar Reads

Why Should We Learn C?

Many later languages have borrowed syntax/features directly or indirectly from the C language. Like syntax of Java, PHP, JavaScript, and many other languages are mainly based on the C language. C++ is nearly a superset of C language (Only a few programs may compile in C, but not in C++)....

Difference Between C and C++

C++ was created to add the OOPs concept into C language so they both have very similar syntax but both are a bit different from each other. Following are some main differences between C and C++ Programming language....

Beginning with C Programming

Writing the First Program in C...

Components of a C Program:

1. Header Files Inclusion – Line 1 [#include ]...

How to Execute the Above Program?

In order to execute the above program, we need to first compile it using a compiler and then we can run the generated executable. There are online IDEs available for free like GeeksforGeeksIDE, that can be used to start development in C without installing a compiler....

Application of C

Operating systems: C is widely used for developing operating systems such as Unix, Linux, and Windows.Embedded systems: C is a popular language for developing embedded systems such as microcontrollers, microprocessors, and other electronic devices.System software: C is used for developing system software such as device drivers, compilers, and assemblers.Networking: C is widely used for developing networking applications such as web servers, network protocols, and network drivers.Database systems: C is used for developing database systems such as Oracle, MySQL, and PostgreSQL.Gaming: C is often used for developing computer games due to its ability to handle low-level hardware interactions.Artificial Intelligence: C is used for developing artificial intelligence and machine learning applications such as neural networks and deep learning algorithms.Scientific applications: C is used for developing scientific applications such as simulation software and numerical analysis tools.Financial applications: C is used for developing financial applications such as stock market analysis and trading systems....