Call by value and Call by reference in C Programming

Call by value and Call by reference in C are two ways to pass arguments in a function Lets see above one by one Call by value Whenever we call a function and passes the value of variable to the called function is called call by value.

OUTPUT

Call by reference Whenever we … Read more

Multi-dimensional Array in C Programming

C programming language also support multidimensional arrays. Syntax of multidimensional array declaration: Data_type    array_name[size1][size2]…[sizeN]; For example, if we want to creates a three dimensional integer array − int  num[5][10][4]; Two-dimensional Arrays The simplest form of multidimensional array is the two-dimensional array. if we want to declare a two dimensional integer array of size [x][y] ( … Read more

Pointer to Pointer in C Programming

In  C language, a pointer is an address. Normally, a pointer variable contains the address of a another variable.  A pointer to a pointer is a chain of pointers.  Or Pointer to pointer means one pointer variable holds the address of another pointer variable.

Pointers in C Programming

In    programming, variable is used to hole the value & this variable stored in a memory.  Each variable has a address to identify where these variables actually stored in a memory.     In a C programming language, pointer is a variable which can hold the address of another variable.   Accessing Address of Variable In … Read more

Recursion in C Programming

In C programming language, a function that calls itself is known as a recursive function. And, this technique is called as recursion.  Recursive functions are very useful to solve many problems such as  Towers of Hanoi (TOH), Inorder/Preorder/Postorder Tree Traversals, DFS of Graph, etc. How recursion works?

Example: Write a program in a C language to … Read more

Union in C Programming

In C programming language, union is a special user defined data type that allows to store different data types in the same memory location. “union”  uses the same memory location for multiple-purpose.  Or In a union data type, single variable, i.e., same memory location, can be used to store multiple types of data. In c programming … Read more

Structures in C Programming

There are various types of data type such as int, char float etc. For example:  int  i;      here variable i can store only data of integer type            char c;   here variable c can store only data of character type           float  f; here variable f can store only data of floting-point type … Read more

File handling programs in C Programming

Example : Write a C program to copy the contents of one file to another file.

OUTPUT

Example : Write a C program to appends the content of file at the end of another file. Or  Example : Write a C program to merge two files into third file.

Example: Write a C program … Read more

Writing to a File in C Programming

To write on a file there are following  function available:  Function fputc() : function fputc() write individual characters at a time to the file. The syntax of this function is – Syntax :                int  fputc( int c,  FILE *fp ); Function fputc()  returns the written character written on success and  if there is an error it will return … Read more

File Handling in C Programming

A file represents a sequence of bytes and these file’s is used to store information. There are various different operations that we can be performed on a file are: Creation of a new file (fopen with attributes as “a” or “a+” or “w” or “w++”) Opening an existing file (fopen) Reading from file (fscanf or … Read more