【程序分析题】#define uchar unsigned char uchar temp; P1=0xff; temp=P1&0xff; if(temp!=0xff)
举一反三
- 假设x和y是某C语言程序中的两个char型变量,x=0x5F和y=0xA0,根据C语言中的按位运算和逻辑运算的定义,x^y、x&y、x|y、~x|~y的结果是( ) A: 0xFF,0x0F,0xFF,0xFF B: 0xFF,0x00,0xFF,0xFF C: 0xFF,0x00,0x0F,0xFF D: 0xFF,0x00,0xFF,0x0F
- There are ( ) basic paths for the following program.int FUN(int count, int flag){ int temp=0; while(count>0){ if(0==flag){ temp=count+100; } else{ if(1==flag) temp=temp+10; else temp=temp+20; } count--; } return temp;} A: 2 B: 3 C: 4 D: 4
- 下面程序的运行结果为。 def swap(list): temp=list[0] list[0]=list[1] list[1]=temp list=[1,2] swap(list) print(list)
- 将变量temp定义为片外RAM区的无符号字符型变量的正确写法是( ) A: unsigned char data temp B: signed char data temp C: unsigned char code temp D: unsigned char xdata temp
- 下面哪个选项可以交换指针p和q所指的int型变量的值? A: temp = *p; *p = *q; *q = temp; B: temp = p; p = q; q = temp; C: temp = p; *p = *q; q = temp; D: temp = &p; *p = *q; q = *temp;