0

Why can't I use double pointer here?

https://code.sololearn.com/csa6LZz7FtzR/?ref=app Why do I get error when I wanna store address of ptr in another pointer?

15th Jul 2021, 12:50 PM
Srinath
3 ответов
+ 1
#include <stdio.h> int main() { int a,*ptr=NULL,**p=NULL; scanf("%d",&a); ptr=&a; p=&ptr; printf("%d\n",a); printf("%d\n",*ptr); printf("%d\n",**p); printf("%p\n",&a); printf("%p\n",ptr); printf("%p\n",&ptr); return 0; }
15th Jul 2021, 2:48 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
+ 3
A pointer that stores the address of a pointer to an integer would have the type int**. You are simply missing an asterisk when declaring 'p'.
15th Jul 2021, 12:59 PM
Shadow
Shadow - avatar
15th Jul 2021, 3:01 PM
Srinath