C Programming Tutorial

Functions in C Programming

Function is a logically grouped set of statements that perform a specific task. In C program, a function is created to achieve something. Every C program has at least one function i.e. main() where the execution of the program starts. It is a mandatory function in C. 

Arrays in C Programming

Array is a collection of data of same types stored in sequential memory location. It is a linear data structure, where data is stored linearly one after the other. The elements in an array is accessed using an index. In C, the index of array starts from zero. For example, in an array of n elements, the first element has index zero and the last element has index (n-1). Elements with consecutive index (i.e.

Nested loop in C

A loop inside another loop is called a nested loop. The depth of nested loop depends on the complexity of a problem. We can have any number of nested loops as required. Consider a nested loop where the outer loop runs n times and consists of another loop inside it. The inner loop runs m times. Then, the total number of times the inner loop runs during the program execution is n*m.

switch case statement in C programming

switch case is a multiple branching statement which compares the value of expression or variable inside switch() with various cases provided with the statement and executes a block when a match is found. If no cases inside the switch is matched, the statements inside default block is executed. However, default is optional and may not be present.

if statement in C Programming

Decision making is an important part of programming. Every programming language supports decision making statements allowing programmers to branch according to the condition. In C programming language, if statement is used to check condition and make decision. The decisions or statements are enclosed inside curly braces, however if only a single statement has to be executed, curly braces are not mandatory.