Answer the question
In order to leave comments, you need to log in
C write value by reference to reference?
There is this code:
int *i;
i=(int *)0x403040;
*i=(int)malloc(sizeof(int));
int *i;
int *z;
i=(int *)0x403040;
z=(int *)malloc(sizeof(int));
*z=31337;
*i=(int)z;
Answer the question
In order to leave comments, you need to log in
I thought you were trying to invent a pointer to a pointer. Such constructions are supported by the language:
int *i = NULL; //указатель на ячейку типа int
int **pi = &i; //указатель на указатель на int
int *a = (int *)malloc(sizeof(int)); создаем саму ячейку
*a = 10; // записываем в нее значение
*pi = a;//теперь i и a указывают на число 10
free(a); //ячейка помечена как свободная. i и a ссылаются на "мусор"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question