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?
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;
}
+ 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'.
+ 1
🌀 Shail Murtaza شعیل مرتضیٰ Shadow ohh got it, thanks 👍