Playing with pointers
To show the location of variables
#include<conio.h>
#include<iostream.h>
void main()
{
int a,arr[2];
cout<<&a;
cout<<"\n";
cout<<&arr[0];
getch();
clrscr();
}
To use pointers
#include<conio.h>
#include<stdio.h>
#include<iostream.h>
void main()
{
int a=20;
int *ip;
ip=&a;
printf("the value of adress is %x\n",&a);
printf("the value of pointer variable %x\n",&ip);
printf("the value of *ip %x\n", *ip);
getch();
clrscr();
}
Posted by lol ik
Comments
Post a Comment