c语言习题求解 执行以下程序后,a的值为 ,b的值为 .#includemain(){int a,b,k=4,m=6,*p1=&k,*p2=&m;a=p1==&m;b=(*p1)/(*p2)+7;printf("a=%d\n",a);printf("b=%d\n",b);}
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/24 09:29:30
![c语言习题求解 执行以下程序后,a的值为 ,b的值为 .#includemain(){int a,b,k=4,m=6,*p1=&k,*p2=&m;a=p1==&m;b=(*p1)/(*p2)+7;printf(](/uploads/image/z/14232562-34-2.jpg?t=c%E8%AF%AD%E8%A8%80%E4%B9%A0%E9%A2%98%E6%B1%82%E8%A7%A3+%E6%89%A7%E8%A1%8C%E4%BB%A5%E4%B8%8B%E7%A8%8B%E5%BA%8F%E5%90%8E%2Ca%E7%9A%84%E5%80%BC%E4%B8%BA+%2Cb%E7%9A%84%E5%80%BC%E4%B8%BA+.%23includemain%28%29%7Bint+a%2Cb%2Ck%3D4%2Cm%3D6%2C%2Ap1%3D%26k%2C%2Ap2%3D%26m%3Ba%3Dp1%3D%3D%26m%3Bb%3D%28%2Ap1%29%2F%28%2Ap2%29%2B7%3Bprintf%28%22a%3D%25d%5Cn%22%2Ca%29%3Bprintf%28%22b%3D%25d%5Cn%22%2Cb%29%3B%7D)
xQ[KA+Q9Kz1)B+]PD
/"5/3=wK=g93wFR!cpgtsYshc4ҟ2!)!fSOc E^(݃vGpQ2MC>zZoh-i"#'?D7?yӁjxKq@,)٦d!p$q4̄Rof݇Y27cL[_%o&$jP߂{<'ZcRר^֟ioYzm}R&g)6@Yқ=r{8 KRYv=uZ/=k8w,%{5Ȫ4ߢ4&Sڧ$$-bLkn-l-^G##yj>^=+~簍
c语言习题求解 执行以下程序后,a的值为 ,b的值为 .#includemain(){int a,b,k=4,m=6,*p1=&k,*p2=&m;a=p1==&m;b=(*p1)/(*p2)+7;printf("a=%d\n",a);printf("b=%d\n",b);}
c语言习题求解 执行以下程序后,a的值为 ,b的值为 .
#include
main()
{
int a,b,k=4,m=6,*p1=&k,*p2=&m;
a=p1==&m;
b=(*p1)/(*p2)+7;
printf("a=%d\n",a);
printf("b=%d\n",b);
}
c语言习题求解 执行以下程序后,a的值为 ,b的值为 .#includemain(){int a,b,k=4,m=6,*p1=&k,*p2=&m;a=p1==&m;b=(*p1)/(*p2)+7;printf("a=%d\n",a);printf("b=%d\n",b);}
a = 0;
b = 7;
解析:
a = p1 == &m;
根据运算符优先级,先运算 p1 == &m,条件为假,返回值为0,a为int型,转换为int即a = 0;
b= (*p1)/(*p2) + 7;
直接按指针目标,就是k/m +7结果是7.66……,b为int类型,转换时舍去小数,结果为7