FREE TUTORIALS ON C programming

Sunday, January 26, 2014

Now i am going to explain a very tricky concept in c programming which is about pointer, first of all pointer is a variable just like all other variables and it is used to store something but pointers are special because in them we can store address of other variable

The example below will demonstrate the use of pointers


#include<stdio.h>

int main()

{

      int *ptr;     // declare a integer pointer

     int a = 10;    //variable a is initialised to  10

    ptr = &a;     // initialisation of pointer with the address of a

    printf("%d",*ptr);   // printing the value in a by deferencing a pointer


    return 0;


}



The above program demonstrate the use of pointer in c programming , it is one of the most important concept in c programming.
7:50 PM   Posted by Unknown with No comments

0 comments:

Post a Comment

Bookmark Us

Delicious Digg Facebook Favorites More Stumbleupon Twitter

Search