Professional Documents
Culture Documents
Pointers: Problem 1
Pointers: Problem 1
Problem 1:-
#include<stdio.h>
#include<conio.h>
void main()
{
p=&a;
q=&b;
clrscr();
printf("\n\n\t\t Display the Address of variable using pointer");
printf("\n\t\t*****************************************
*****");
//prompt user to enter value
printf("\n\t Enter the value of a \t:\t");
scanf("%d",&a);
getch();
}
output 1:-
Problem 2:-
#include<stdio.h>
#include<conio.h>
void main()
{
int *p;
int *q;
int *r;
int a;
int b;
int c;
p=&a;
q=&b;
r=&c;
clrscr();
printf("\n\t\t Add the value of two variable and store in
another variable using pointer");
printf("\n\t\t*****************************************
********************************");
output 2:
Display #include<stdio.h>
#include<conio.h>
void main()
{
//declaration and initilzation of variable
int a = 10;
int b =12;
int *x;
int *y;
int temp;
clrscr();
x=&a;
y=&b;
Program output: