('지능'이) :오류 : '단항 *'의 유효하지 않은 유형의 인수가 나는 C 프로그램을
error: invalid type argument of ‘unary *’ (have ‘int’)
누군가가 무엇을이 오류를 설명 할 수 :
#include <stdio.h>
int main(){
int b = 10; //assign the integer 10 to variable 'b'
int *a; //declare a pointer to an integer 'a'
a=(int *)&b; //Get the memory location of variable 'b' cast it
//to an int pointer and assign it to pointer 'a'
int *c; //declare a pointer to an integer 'c'
c=(int *)&a; //Get the memory location of variable 'a' which is
//a pointer to 'b'. Cast that to an int pointer
//and assign it to pointer 'c'.
printf("%d",(**c)); //ERROR HAPPENS HERE.
return 0;
}
컴파일러 오류가 발생합니다 방법?
답안에 캐스트가 없다는 점에 유의하십시오. 질문에있는 캐스트는 'int **'를'int * '에 대입하고있는 라인의 문제를 숨 깁니다. ('c = (int *) & a;') – Thanatos