-2
谁能告诉我为什么这个程序打印3作为输出或告诉程序的功能。无法理解程序的输出
#include<stdio.h>
#include<stdlib.h>
struct st
{
int a;
int b;
};
void func(struct st*);
int main()
{
struct st ab={128,768};
struct st *pq=&ab;
func(pq);
return 0;
}
void func(struct st *p)
{
char *pt;
p->a=768;
p->b=128;
pt=(char*)p;
printf("----%d\n",*(++pt));
}
'768':'0x0300'。 – BLUEPIXY
你是否从某处复制了此代码并询问我们为什么代码无法工作? –
它是一个面试问题,昨天有人问我。所以不能从任何网站复制(至少据我说)。 –