## Declaring variables in C language

C programming language allows to define and classify data so we can use it appropriately in various parts of the program in the correct form with or without changing the original value or just copying the original value. Any data that we need to use in the program need to be stored in the memory….

## C Programming Language

C language developed at Bell lab by Dennis Ritchie on UNIX environment. UNIX was later rewritten in C. An earlier version of C is BCPL (Basic Combined Programming Language) developed by Ken Thompson. When it was later improvised by Dennis, it became C (‘C’ from BCPL) programming language. C program could be written either in…

## Recursive C program for Binary search

Below is an example Recursive C program to perform Binary – int binsearch(int low, int high, in a[], X){ int mid; if(low > high){ return(-1); } mid = (low + high) / 2; return(X == a[mid] ? mid : X < a [mid] ? binsearch(low, mid-1, a[], X) : binsearch (mid+1,high,a[],X)) }

## Recursive C program to print Fibonacci series

Below is an example recursive C program to return Fibonacci series for a given number – int fibonacci (int x){ if(n < 0){ printf("Invalid input"); exit(1); } else{ return ((n==1 || n==1)? n : fib(n-2) + fib(n-1)); } }

## C program for finding factorial by recursion

Here is a C program to find a factorial by recursive method – int factorial (int x ) { return ( n==0? 1: n*(fact(n-1))); }

## Bubble sort in C

Simple bubble sort in C – for (i=0; i<n-1; i++){ for(j=i+1; j<n; j++){ if(x[j] < x[i]){ temp = x[j]; x[j] = x[i]; x[i] = temp; } } }

## Tree representation in C

Below is an example to represent a Tree structure in C using struct

## File Operation in C

Below is a simple C program to perform file operation – include <stdlib.h> main() { FILE * file_source char * file_name = (char*) malloc (sizeof (char)* 13); char * file_content= (char*) malloc (sizeof (char)* 100); printf(“Enter File Name>”); gets (file_name); file_source = fopen(file_name, “r+”); if(file_source == NULL) { printf(“File doesn’t exist”); } else{ while (…