C Language Tutorial

Introduction to C Programming C is most popular and widely used computer programming language. It was developed by Dennis Ritchie in 1972 at the Bell Lab. It is used to develop system application software. There are various UNIX application developed in C language like OS, Compiler and many more. C Language History  C was started as a UNIX program Bell Lab.Dennis Ritchie was the founder of C Language. C language is …

Read moreC Language Tutorial

Features of C Language

We should use C Language because of its features and we can develop various types of system applications like text editor, print spooler, network driver and many more. Features of C Language C has various features that are given below: It is easy to learn. It is system programming Language. It can handle low-level activities. It is a procedural language. It has rich libraries etc. ← Prev Next →

C Language Environment Setup

To compile C program, we must have GCC compiler installed on our machine. In this C tutorial, all the examples are compiled and tested using GCC compiler. Although we can use other C compilers also, GCC provides better performance. Installation To installGCC(GNU Compiler Collection), visit official site (http://mingw.org/download/installer)and download after downloading we can install it in our system and compile or executeCand C++ program easily. There are following some …

Read moreC Language Environment Setup

Execution flow of C program

There are various steps of the execution of the C program that is given below. The following step of the execution Write source codes Preprocess Compile Link edit Load Execute Editor or IDE: This is the first step while writing the source codes of the program, there must require any editor or IDE (like notepad and notepad++ etc) where we can write own source code and save it by …

Read moreExecution flow of C program

C printf and Scanf

Input-Output functions in C Programming In C Language, the printf() and scanf() are inbuilt library functions that used for input and output. It is defined in the header file“<stdio.h>”. printf() Function: In C programming language, printf() function is used to print the values. The values may be character, string,float,integer etc. We can use different types of format specifier to display the value of the program. Format Specifier Description %d …

Read moreC printf and Scanf

C Data type

Data Types in C with Examples Data types are used to define the type of data that a variable can store to perform a specific operation. ANSI C provides three types of data-types. Primary Data Types Derived Data Type User Defined Data Types Primitive data types: Void It holds no value and generally used with function. Int It is used to denote an integer type. Char It is used …

Read moreC Data type

C Token

C Token and Keyword The C tokens are the basic buildings blocks in C language which are constructed together to write a C program. Each and every smallest individual unit in the C program is known as C Tokens. There are six types of tokens in the C language that are given below: Keywords Identifier Constant String Operator Punctuation Lets us consider an example of Token. Keywords in C The keyword is …

Read moreC Token

Variable in C

Variable is an identifier that holds data in memory. It is used to identify input data in a program. The value of the variable can change at the time of executions. Let’s consider the syntax of a variable.

We can also declare multiple variables with the same data type by using comma (,). Example:

  Rules for declaring the variable: Variable name should start with alphabets or …

Read moreVariable in C

Operators in C

An operator is a special symbol that tells the compiler to perform specific mathematical or logical operations. It is the combination of constants and variables through expressions. Example:

Where, =, +,* are operators, a,b,c are the variables and  5 is the constants. There are various types of the operator in C Language. Types of Operator Arithmetic Operators Relational Operators Logical Operators Bitwise Operators Assignment Operators Misc Operators Increment/Decrement …

Read moreOperators in C

Comments in C

Comments are used to comment on the line of code in the program. Comments are a way of inserting remarks and reminders into code without affecting its behavior. The compiler ignores comments, treating them as though they were whitespace. There are two types of comments: Single Line Comments Multiple Line Comments   Single Line Comments: Single line comment is used to comment on the single line of program code. …

Read moreComments in C

Escape Sequence in C

An escape sequence is a sequence of character that used inside the string literal or character.  All the escape sequence is used with the backslash (\) symbol. The list of an Escape sequence is as follows: Escape Sequence Meaning \a Alarm or Beep \b Backspace \f Form Feed \n New Line \r Carriage Return \t Tab (Horizontal) \v Vertical Tab \\ Backslash \’ Single Quote \” Double Quote \? …

Read moreEscape Sequence in C

C – Storage Classes

C storage class is used to define the scope variables and function. There are four various types of storage classes that are given below. auto: The auto keyword is the default storage class for all the local variables. Let us consider an example.

static: In C language, static storage class is initialized only once time and use until when the program will be closed. It has default value …

Read moreC – Storage Classes

C Decision control statement

Decision Making C conditional statements are used to specify one or more conditions. The statements will be executed if the condition becomes true otherwise alternative statement will be executed if the condition becomes false. C language supports the following statement: If statement Switch Statement Conditional operator statement goto statement If statement If statement is used to perform the operation according to condition. In other words, we can say that …

Read moreC Decision control statement

Loop Statement in C

Loop statement is used to execute one or more statement repeatedly multiple times. There are three types of loops in C language. Why use loop? We can use loop because it executes a block of code multiple times and it reduces the length of the code. Example:  Let suppose we have to print counting 1to 50 then we have to use 50 times lines of code but if we …

Read moreLoop Statement in C

Break, continue and goto statement in C

Break statement Break statement is used to break the process of a loop (while, do while and for) and switch case.

Example 1

Example 2

  Continue Statement: The Continue statement is used to continue the execution of the loop. It is used inside if condition. We can use it with while, do while and for loop. Syntax:

Let us take an example:

Output …

Read moreBreak, continue and goto statement in C

Type Casting in C

Type casting is a way to convert a variable from one data type to another data type. Syntax:



← Prev Next →

Function in C

Function is a group of statements that are used to perform any task. In other words, we can say that a function is a self- contained a block of programs that perform a coherent task. Why to use function A function is used to divide a large code into modules that help us to debug and maintain the code. We can call any function multiple times. There are various …

Read moreFunction in C

Recursion in C

Recursion is a programming technique that allows the programmer to call the function within the same function. The function which calls the same function is known as recursive function but a function that calls itself and doesn’t perform any task after function call is known as tail recursion. Let us take an example: Example 1

  Example 2


← Prev Next →

String in C

String is a collection of character or group of characters. In array, string of character is terminated by a null value “\0” and enclose between double quote. We can declare string in two ways: By char array. By string literal Let us consider how to declare of string by char array.

There are various types of string functions supported by C language. String Function Description strcpy(a1, a2); …

Read moreString in C

C Array

An array is a collection of elements that are used to hold the fixed number of values of the same type. We cannot change the size and type of array after its declaration. Why should we use an Array? We should use an array because of its properties: It reduces the code while using the array. It is easy to traverse the data. It is easy to short the …

Read moreC Array