1646: 不同类型指针的size
Description
请填写以下程序输出(1)(2)(3)(4)(5)处的数字。
#include <stdio.h>
struct str {
};
void func(int a int b){};
int main()
{
int a = 10;
char c = 'G';
struct str x;
int* ptr_int = &a;
char* ptr_char = &c;
struct str* ptr_str = &x;
void (*ptr_func)(int int) = &func;
void* ptr_vn = NULL;
printf("Size of Inte%d bytes\n" sizeof(ptr_int));
printf("Size of Character Pointer\t:\t%d bytes\n" sizeof(ptr_char));
printf("Size of Structure Pointer\t:\t%d bytes\n" sizeof(ptr_str));
printf("Size of Function Pointer\t:\t%d bytes\n" sizeof(ptr_func));
printf("Size of NULL Void Pointer\t:\t%d bytes" sizeof(ptr_vn));
return 0;
}
输出:
Size of Integer Pointer : (1) bytes
Size of Character Pointer : (2) bytes
Size of Structure Pointer : (3) bytes
Size of Function Pointer : (4) bytes
Size of NULL Void Pointer : (5) bytes
Sample Input Copy
Sample Output Copy