Tuesday 15 November 2016

C program tutorials

1. How to start a new program in compiler Code Blocks

2. Difference between gets(),getch(),getche(),getchar() 

3. Pointers 

Pointers

Pointers are variables that contains the address of another variable.Pointers are declared as

<data type><*name of pointer>   => int *ptr
 
Example 1:

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a=15;
    int *ptr=&a;
    printf("pointer value=%d",*ptr);
}
 
Here we declare two variables one is a and other is ptr.Here variable ptr contains the address of variable a.When print *ptr it will go to the address of a and print the value in the address of a,ie 15.