Pointer is a variable which stores address of another variable. It points to an address of a value.
Pointers in C language is declared using * i.e. asterik symbol.
int *i;//pointer to int
char *ch;//pointer to char .
Example
#include <stdio.h>
#include <conio.h>
void main(){
int num=20;
int *b;
clrscr();
b=#//stores the address of num variable
printf("Address of number variable is %x \n",&num);
printf("Address of p variable is %x \n",b);
printf("Value of p variable is %d \n",*b);
getch();
}
Output
Address of num variable is fff4
Address of b variable is fff4
Value of b variable is 20
0 Comment(s)