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

1 Answer

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

Print Address of Character and String Using Pointers

In this program we are going to print address of character and string using pointers. As we know a string is a stream of characters and each character holds different address. So to print address of each character's address we are going to take a pointer array to hold address of each character as in the following example.

Example :

void main()

//Declaration and initialization of character and string
char str[30]="Goeduhub Technologies";
char c='A';
int i;
//Declaration and assignment of pointers
char *ptr_str[30];
char *ptr_c=&c;

//Assigning address of each character of string to pointer array

//Printing value and address of variables on output window
printf("\nString Entered is : %s\n Address of string :",str);
printf("\n%c's address : %p",str[i],ptr_str[i]);
printf("\nValue of c = %c\nAddress of c = %p",c,ptr_c);

Output :

Output of above program showing address of string using pointer

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


Ms. Nisha

An alumna of IIT-BHU

Related questions


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