Home C C++ Java Python Perl PHP SQL JavaScript Linux Online Test

Home » C Programming » C Tutorial

C Tutorial - Learn C Programming Step by Step

This is a guide to C programming. All topics are presented in order of difficulty.

History of C language

The C Programming language was developed in 1970s by Dennis M. Ritchie at Bell Labs ( AT & T ). In the 1960s Dennis worked with others employees of Bell Laps, on a project known as Multics. The Goal of the "Multics" project was to developed an operating system that could be used by thousands users. In 1969s AT&T withdrew the project, because the project couldn't produce an economically useful system.
More >>


The First C Program - Hello Word

Learn first C program step by step. Breakup of "Hello Word" by keywords. Learn every single piece of C program.
More >>


Compilation & Execution of C Program

Compilation of C program is divided into couple of phases, each phase has its own important role and produces different type of output file.
More >>


How to compile C programs in Dev-C++

Dev-C++ is full integrated development environment for Windows. It uses MinGW and GCC to compiler C code. This compiler has option to compile code for 32 or 64 bits.
More >>


How to compile C programs in GCC / Linux

The GCC ( GNU Collection of Compiler) produced by GNU project which support various programming languages. GCC is standard compiler for UNIX like operating system.
More >>


C Variables, Constants & Data Types

In programming context variables are simply names used to refer to some location in memory and are used to hold some value. The type of value any variable will hold depends on its data type. Variables can have any name but there are few rules for variable names.
More >>


Comments in C programming - Single & Multiline comments

C programming has only one type of comment i.e /* */ which is used as single line as well as multiline comment.
More >>


Storage Classes in C programing - auto, static, register & extern

Storage classes defines the location of variable in memory and default value it is assign to it.
More >>


C Conditional Statements : if, if else, if elseif else & Nested if

If condition returns true then the statements inside body of "if" are executed and the statements inside body of "else" are skipped. If condition returns falls then the statements inside the body of "if" are skipped and the statements in "else" are executed. Else If comes in picture when we want to insert few more condition between if and else.
More >>


C Switch Case Statement with Example

A switch case statements is one of the conditional statement in C programming. It is similar to "if else" with few differences. It allows a variable to be tested for equality against a list of value. Each value is known as case.
More >>


C Loops - for, while, do while with break & continue examples

In C programming loops are used to execute a set of statements repeatedly until a particular condition is met. C programming has three loops - for, while and do-while. All of them can be used to do same task but there are few differences.
More >>


Arrays in C - Single, Double and MultiDimensional

Array is group of similar type of elements. In C programming we can create array of any data type ( predefined or user defined). Array index starts from 0 and keep on increasing by 1 for next elements. Array address is the address of its first element.
More >>


Functions in C programing - Inline & Recursive

Functions are group of statements to perform specific task. A function can have declaration, body & call. Syntax of function is function-name(arg1, arg2, ..). In C programming functions can be categorized in two categories User defined and Library functions.
More >>


Pointers in C Programming

Pointers are special type of variable that stores the address of another variable. Pointer can be declared as any data type like char, int, float, double etc. We can also declare pointer as any user defined data type like structure, enum & union. When pointer is declared as predefined data type then we can get its value using *ptr while when pointer is declared as user defined data type then members are accessed using "->".
More >>


Function Pointer in C programming

Function pointer is a special type of pointer which can point to any function. It is similar to normal pointer since both store address. There are many good usage of function pointer in C programming.
More >>


C Tutorial on strings and its related library functions

Group of character is known as string in C programming. String is also know as char array. There are many library function which work on strings like strlen(), strstr(), strcmp() etc.
More >>


Formatted Input/Output using printf() & scanf()

The printf() and scanf() are two commonly used library function in C programming to print the output to standard ouput and read input from standard iput i.e keyboard.
More >>


C Tutorial on Structure

Structure is use defined data type which can contain similar or different type of members in it. Like predefined data types, we can create variable of structure, array of strucutre, pointer to structure etc.. The size of structure is the sum of the sizes of its all memebers.
More >>


C Tutorial on Enums

Similar to Struture, Enum is also user defined data type but it can't contain members with different data types. Enum is mainly used to assign names to integral constants, the names make any program easy to read.
More >>


C Tutorial on Union

Union is also a special a user defined data type in C programming. It may contain different type of elements but the memory location of all elements is same (all elements share same memory location) due to this feature only one element is used at one time.
More >>


File I/O in C Programming - Create, Open, Read, Write & Close

There are large number of library functions to handle file input/ouptut in C programming. In this tutorial you will learn to use fopen(), close(), fprint(), fscanf(), fread(), seekg(), seekp(), feesk() etc..
More >>


Memory Management in C - malloc(), free(), calloc() & realloc()

In C programming library functions are used to allocate and deallocate memory. These functions are malloc(), calloc(), realloc() and free(). These functions operates on memory allocated on Heap. Memory allocated using library functions is also know as run time memory and the memory must be freed otherwise the result is in memory leak.
More >>


Error Handling in C programming

C programming doesn't support execeptional handling but there are ways to prevent error by checking return values from the functions. There are few functions and variable in error.h header file which can be used for error handling in C.
More >>


TypeCasting in C - Implicit & Explicit

Type casting is used to convert one data type into another. C support two type of castign Implicit & Explicit. Implicity type casting happens automatically i.e we don't need to put any operator. For explicit type casting we have to use () operators.
More >>


What is next? Solve Multiple Choice Questions