5.4 作业

#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);
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值