C Programming Tutorial | Learn C programming Language
C Programming Language Tutorial
C Programming is an ANSI/ISO standard and powerful programming language for developing real time applications. C programming language was invented by Dennis Ritchie at the Bell Laboratories in 1972. C is most widely used programming language even today. All other programming languages were derived directly or indirectly from C programming concepts. This tutorial explains all basic concepts in C like history of C language, data types, keywords, constants, variables, operators, expressions, control statements, array, pointer, string, library functions, structures and unions etc.
This C programming tutorial is designed for the new learners, students and also for the corporate level developers who want to learn and refresh their C programming skills.
Basic C programs
C programming is considered as the base for other programming languages, that is why it is known as mother language.
C programming basics:
Steps to be followed for any C program to create and get the output are explained . This is common to all C programs and there is no exception, whether its a very small C program or very large program. Structure of a C program is defined by a set of rules called protocol, to be followed by programmer while writing a C program.
C – printf and scanf:
printf() and scanf() functions are inbuilt library functions in C which are available in the C library by default. These functions are declared and related macros are defined in “stdio.h” which is a header file. We have to include “stdio.h” file as shown in below C program to make use of these printf() and scanf() library functions
C – Data Types:
C data types are defined as the data storage format that a variable can store a data to perform a specific operation. Data types are used to define a variable before using in a program.
C – Tokens and keywords:
C tokens, Identifiers and Keywords are the basics in a C program. All are explained in this page with definition and simple example programs. C tokens are the basic building blocks in C language which are constructed together to write a C program.
C – Constants:
C Constants are also like normal variables. But, the only difference is, their values can’t be modified by the program once they are defined. Constants refer to fixed values.
C – Variables:
C variable is a named location in a memory where a program can manipulate the data. This location is used to hold the value of the variable. The value of the C variable may get changed in the program.
C – Operators and Expressions:
The symbols which are used to perform logical and mathematical operations in a C program are called C operators.
C – Decision Control statements:
In decision control statements (C – if else and nested if), group of statement is executed when the condition is true. If the condition is false, then, else part statements are executed.
C – Loop control statements:
Loop control statements in C programming are used to perform looping operations until the given condition is true. Control comes out of the loop statements once the condition becomes false.
C – Case control statements:
The statements which are used to execute only specific block of statements in a series of blocks are called case control statements. There are 4 types of case control statements in C programming.
C – Type Qualifiers:
The keywords which are used to modify the properties of a variable are called type qualifiers. There are two types of qualifiers available in C programming.
C – Storage Class Specifiers:
Storage class specifiers in C programming tell the compiler where to store a variable, how to store the variable, what is the initial value of the variable and the lifetime of the variable.
C – Array:
C Array is a collection of variables belongings to the same data type. You can store group of data of the same data type in an array. There are 2 types of arrays in C programming.
C – String:
C Strings are nothing but array of characters ended with null character (‘\0’). This null character indicates the end of the string. In C programming, strings are always enclosed by double quotes. Whereas, character is enclosed by single quotes in C
C – Pointer:
C Pointer is a variable that stores/points the address of the other variable. C Pointer is used to allocate memory dynamically, i.e. at run time. The variable might be any of the data types such as int, float, char, double, short etc.
C – Functions:
Functions in C programming are basic building blocks in a program. All C programs are written using functions to improve re-usability, understand ability and to keep track of them.
C – Library functions:
Library functions in C language are inbuilt functions which are grouped together and placed in a common place called a library. Each library function in C programming language performs a specific operation.