C Tutorial

C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system. … This tutorial is designed for software programmers with a need to understand the C …

Console I/O function

Console I/O refers to the operation that occur at the keyboard and the screen of your computer. Console I/O function can also be classified in two parts: 1. Formatted console I/O: Formatted I/O function accepts or present in a particular format. The example of formatted console I/O function is printf( ) and scanf( ). printf It is highly …

Console I/O function Read More »

Disc & Port I/O function

Function which performs secondary storage devices like floppy disk or hard disk is called disk I/O functions. Port I/O functions This type of functions performs I/O operation among various codes like printer port, mouse port.  

What is Array?

Whenever there is need to store a group of data of the same type in the memory, arrays are used. Two terms have been described here Array and String. Strings in C are represented by the array only, therefore, it would be convenient to describe strings separately in the same block but in the different …

What is Array? Read More »

What Is Array Declaration?

Array Declaration Arrays are defined in the same manner as ordinary variables, except that each array name must be accompanied by the size specification. The general form of array declaration is: data_type array_name[size]; data-type specifies the type of array, size is a positive integer number or symbolic constant that indicates the maximum number of elements …

What Is Array Declaration? Read More »

What is Two Dimensional Array?

Two dimensional array (2-D array) is also called Matrix General form of 2-D array is: data_type array_name[row_size][column_size]; Example: int marks [4][2] Different ways of Initialization of a 2-Dimensional Array: int table [2][3]={0,0,0,1,1,1}; initialization done by row. int table[2][3]={{0,0,0},{1,1,1}}; surrounding the elements of each row by braces. int table[2][3]={{0,0,0,}, initialization as matrix. An example program that …

What is Two Dimensional Array? Read More »

What is Multi Dimensional Array?

Arrays of three or more dimension is called Multi-Dimensional Array. General form Multi-Dimensional Array: data_type array_name[s1][s2][s3]……[sn]; Example: int survey[3][5][12] Here survey is a 3-dimensionalarray declared to contain 180 integer_type elements. (3x5x12=180) Initialization of 4-Dimensional Array: static int arr [3] [4] [2]={{{2,4}, {7,3}, (3,4}, {5,1}, }, {{3,4}, {3,4}, {3,2}, {4,5}}, {{2,3}, {2,7}, {2,3}, {4,3}}} In this …

What is Multi Dimensional Array? Read More »

What is String?

Strings in C are represented by arrays of characters. The end of the string is marked with a special character, the null character, which is simply the character with the value 0. Because C has no built-in facilities for manipulating entire arrays (copying them, comparing them, etc.), it also has very few built-in facilities for manipulating strings. In fact, C’s only truly built-in string-handling …

What is String? Read More »

What is Function Definition?

Functions are self contained program segments that carry out some specific well defined task. In “C” , we include the header files like stdio, conio, string, etc. These files contain number of library functions which are as follows: printf( ), scanf( ), getchar( ), putchar( ), getche( ), gets( ), puts( ), strlen( ), getch( …

What is Function Definition? Read More »

Function Declaration

Before defining the function, it is desired to declare the function with its prototype. In function prototype, the return value of function, type, and number of argument are specified. Function declaration is written in following ways: return data_type function_name (data_type argument 1, data_type argument 2 …………….data_type argument n) { local variable declaration; executable statement 1; executable statement 2 …

Function Declaration Read More »

What is Function Call?

Function can be called either by value or by reference . A function can be called by specifying its name followed by a list of arguments enclosed in parentheses and separated by commas. From the above example the following line is used as a function call: sum=add(a,b); /* function call */ Call by value: Call by value means directly pass …

What is Function Call? Read More »

What is Recursions?

Repetitive calling of the same function is called recursion. Recursions are those functions which call itself again and again. Recursive functions can easily become infinite loops. An example program to find out the factorial of any number is the one of the best example of recursion: Out put of the program  

What is Pointers?

Pointers are a fundamental part of C. If you cannot use pointers properly then you have basically lost all the power and flexibility that C allows. The secret of C is in its use of pointers. C uses pointers a lot. Why? It is the only way to express some computations. It produces compact and …

What is Pointers? Read More »

What is Pointer expression?

Like other variables pointer variable can also be used in expressions. Arithmetic and comparison operation can be performed on the pointers. Pointer Arithmetic Example: Addition of a number to a pointer int i=4,*j,* j=&i; j=j+1; j=j+9; k=j+3; Example: Subtraction of number from a pointer int i=4,*j,*k; j=&i; j=j-2; j=j-5; k=j-6; But the following operation are …

What is Pointer expression? Read More »

Pointer & functions

Let us now examine the close relationship between pointers and C’s other major parts. We will start with functions. When C passes arguments to functions it passes them by value. There are many cases when we may want to alter a passed argument in the function and receive the new value back once the function …

Pointer & functions Read More »