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.
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.
0 comments:
Post a Comment