Online Courses
Free Tutorials  Go to Your University  Placement Preparation 
0 like 0 dislike
1.7k views

Goeduhub's Top Online Courses @Udemy

For Indian Students- INR 360/- || For International Students- $9.99/-

S.No.

Course Name

 Coupon

1.

Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence || Labeled as Highest Rated Course by Udemy

Apply Coupon

2.

Complete Machine Learning & Data Science with Python| ML A-Z Apply Coupon

3.

Complete Python Programming from scratch | Python Projects Apply Coupon
    More Courses

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

3.3k questions

7.1k answers

394 comments

4.6k users

Related questions

 Goeduhub:

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