다음 코드를 사용하여이 질문에 대한 대답을 찾으려고하지만 포인터의 값 (문제 3의 주소가 매개 변수에서 너무 멀리 떨어져 있음이 밝혀졌습니다. 대체 x = problem3;
포인팅되는 함수의 국소 변수) ...숫자 형 캐스팅 C
void problem3(int a) {
int overflowme[16];
int x = problem3;
overflowme[15] = 102;
printf(" the address of x is %x\n the addres of the first local is %x\n the addres of the first para is %x\n ", x, &overflowme[15], &a);
}
int main(void) {
problem3(101);
}
OUTPUT
the address of x is 42b613
the addres of the first local is 12fed8
the addres of the first para is 12fee4
Press any key to continue . . .
여기서'overflowme'가 어떤 목적을 가지고 있는지 알지 못합니다. . –
그리고 그것은'int main (void)'이어야합니다; 표준 C에서 main 함수는 int를 반환합니다. –
무언가를 성취하려고하거나 C가 할 수있는 것을 실험하고 있습니까? – MatrixFrog