SUMMER TRAINING Free Tutorials  Go To Your University  Placement Preparation 
Project Based Best Summer Training Courses in Jaipur
Join our Telegram Channel To take free Online Courses
0 like 0 dislike
154 views

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.1k points)
edited by
 
Best answer

Pointer to Print Variable Address

In this program we are going to use pointer to print address of a variable in C programming. Pointer variable is used to hold address of the variable. In the simple C program we are going to implement this theory as follows.

Example :

#include<stdio.h>
#include<conio.h>

void main()
{

//Declaration and initialization of three variables
int a=10;
float b=5.2;
char c='A';

//Declaration and assignment of three pointers
int *ptr_a=&a;
float *ptr_b=&b;
char *ptr_c=&c;

//Printing value and address of variables on output window
printf("\nValue of a = %d\nAddress of a = %p",a,ptr_a);
printf("\nValue of b = %d\nAddress of b = %p",b,ptr_b);
printf("\nValue of c = %d\nAddress of c = %p",c,ptr_c);
getch();
}

Output :

Output of above program showing pointer to print variable address


For More GTU C Programming Lab Experiments Click Here

Our Mentors(For AI-ML)


Sharda Godara Chaudhary

Mrs. Sharda Godara Chaudhary

An alumna of MNIT-Jaipur and ACCENTURE, Pune

NISHA (IIT BHU)

Ms. Nisha

An alumna of IIT-BHU

Related questions

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 
...