#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//33
int k = -1;
printf("%d,%u\n", k, k);
//D -1 2^16-1=65535
//34
for(y=1,x=1;y<=50;y++){
if(x>=10) break;
if(x%2==1){
x+=5;
continue;
}
x-=3;
}
//y=1 x=1
//y=2 x=6
//y=2 x=3
//y=4 x=8
//y=4 x=5
//y=6 x=10
//35
void swap(int m, int n){
int temp;
temp=m;m=n;n=temp;
}
main(){
int m=5,n=9;
swap(m,n);
printf("%d, %d\n", m, n);
}
//5 9
//36
#include <stdio.h>
#define SQR(a) a*a
main(){
int b, k=3;
b=SQR(k+1);//b=k+1*k+1
printf("%d", b);//7
}
//C
//37
//设置a的bit3
a|=1<<3;
//清除a的bit3
a&=~(1<<3);
//38
int * const reg = (int *)0x67a9;
*reg=0xaa66;
//39
void foo(void){
unsigned int a = 6;
int b = -20;
(a+b>6)?puts(">6"):puts("<=6");
}
//>6
//40
void main(void);
volatile unsigned char PORT;
void main(void){
PORT=1;
PORT=0;
PORT=1;
}
//3
//41
//h g
//c
//42
//1)10^3
//2)10^6
//3)2.5*10^6
//4)5*10^(-8)
//
//1)10^(-9)
//2)10^(-6)
//3)10^(-3)
//
//1)8
//2)1024
//3)1024
//43
//c b h b c i m
//44
char a[2][10] = {
"abcdefg",
"123456789"
};
const char *str[2] = {
"abcdefg",
"123456789"
};
void main(void){
char *p1;
char (*p2)[10];
const char **p3;
char c;
p1=&a[0][0];
c=*(p1 + 1);
c=*((&p1 + 1) + 4);
p2=a[0];
c=*(p2 + 1);
c=*((&p2 + 1) + 4);
p3=str;
c=*(*p3+1);
c=*(*(p3+1) + 4);
}
5.4 作业
最新推荐文章于 2024-10-09 14:12:51 发布