Can a pointer behave as general variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can a pointer behave as general variable?

#include <stdio.h> int main(void) { char *str[20]; char *sur; printf("how are you, dear xyz?\n"); gets(str); puts(str); sur = &str; printf("%p", sur); return 0; } In this program 'str' is declared as pointer. And define as general variable to store string. How is it possible because pointer variable can only store address ?

13th Jul 2021, 11:17 AM
Suraj
Suraj - avatar
0 Answers