C Programming Tutorial

C, one of the most popular programming languages, is also considered to be a core language as many other languages like C++, Java etc find their concepts drawn from it. It is often said that if you know C Programming language, you can easily learn any other language.

The rich set of built-in functions and operators help in writing complex C programs, making it a robust language. Portability in C i.e. the ability of a C program to run on any system is another quality that makes people vouch on C.

C Programming Tutorial

Learn C with our interesting and complete C Programming tutorial. Starting from C basics, this tutorial will take you to advance topics like C Structures and C Files. Every concept of C programming language has been explained with examples and programs here. The practical approach will make learning C fun for you.

Who is this C Programming Tutorial designed for?

This tutorial is designed for beginners in C programming. Freshers, BCA, BE, BTech, MCA, all engineering and college students will find this C tutorial extremely useful. Book mark the notes on this page for your exam preparation, lab exercises and viva questions.

What do I need to know to begin with?

This C tutorial is designed to guide beginners, so all that you need is a basic understanding of computers and a lot of passion for C Programming!

C Syllabus covered in this tutorial

We will cover here:
Introduction to C, First C Program, Files, Keywords and Identifiers, Data Types, Variables and Constants, Input/Output statements, Operators, Decision Control Statement, Loops, Functions, Arrays, Strings, Sorting, Preprocessor Directives, Pointers, Structures, Files.

That's pretty much everything about C Programming Language, so let's begin with the tutorial!

Introduction to C

  • 'C' is a programming language that was developed in the early 1970s by Dennis Ritchie at Bell Laboratories.
  • It was designed for implementing system software and used for developing the portable application software.
  • It is one of the most popular languages.
  • C++ and Java are based on C programming which means that if you are well versed with C, then the above two programming languages can be learnt very easily.
  • It is primarily used for the system programming. It has the portability, efficiency and the ability to access the specific hardware addresses and low runtime demand on system resources which makes it a good choice for implementation of operating systems and embed the system applications.

Characteristics of C

  • C is a core language as many other programming labguages like C++, Java etc are based on it.
  • C is a portable language because if we write a C program on one computer we can run it on another one without little or no modification.
  • C is known as a robust language because it has a rich set of built-in functions and operators that help in writing complex programs.
  • It is a stable language as it was created in 1983 and since then it has never been revised.
  • It is a quick language as they make use of operators and data types which are fast and efficient.
  • It is an extensible language as it helps the user to add his own functions to the C library.
  • It is known as a structured language as the code is organized as a collection of one or more functions.
  • It supports loose typing because a character here can be treated as an integer and vice versa.
  • C has only 32 keywords which makes it easy to learn.
  • Pointers are supported in C as they refer to the computer memory, array, structures and the functions.
  • The features of assembly language and high-level language are combined by the C compiler.
  • It is a high level programming language which enables the programmer for concentrating on the problem at hand and not worry about the machine code on which the program would run.
  • There is an extensive usage of function calls.
  • It is well suited for structured programming which enables the users to think of the problems in terms of functions/modules.  It makes a complete program which in turn facilitates easy programming, debugging, testing and maintenance.
  • It is widely used for implementing end-user applications.

Structure of a C program

c program structure

Preprocessor directives: They contain special instructions which indicate how the program is prepared for compilation. Common preprocessor command is 'include' that tells the compiler to execute a program where some information is required from the specified header file.

Global declaration: It is a variable/function which is declared after the preprocessor directives and before the main() function.


#include <stdio.h>
#include <conio.h>
int add (int a, int b);
void main()

  • A C program contains more than one function where the functions are defined together as a group and all the statements are executed together. The statements are written logically and in a sequence for performing certain tasks.
  • The main() function is one of the most important parts of the program. It is a compulsory part of every C program.
  • All the functions in the program which include the main() function are divided into two parts -
    Declaration section: describes the data that will be used in the function.
    Statement section: contains the code that will manipulate the data for specified tasks.
  • A C program can have a number of functions depending on the number of tasks.  Any number of statements can be included in the function.