#include <stdio.h>

/*
int main()
{
short s = 0;
int a = 10;
printf("%d\n",sizeof(s=a+5));//2 4个字节的整形放入2个字节的short中,应为2个字节
printf("%d\n",s);//0
return 0;
}
*/


/*
int main()
{
int a = 0;
// a--> 00000000000000000000000000000000 ->原码
// ~a-->11111111111111111111111111111111 ->补码
// 11111111111111111111111111111110 ->反码
//printf打印原码 10000000000000000000000000000001 ->原码
printf("%d\n",~a);//按二进制位取反
// - 1

return 0;

}
*/


/*
int main()
{
int a = 10;
//printf("%d\n",++a);//前置++ -->先++后使用
printf("%d\n",a++);//后置++ -->先使用后++

return 0;
}
*/

/*
int main()
{
int a = (int) 3.14;
printf("%d\n",a);

return 0;
}
*/

/*
void test1(int arr[])
{
printf("%d\n",sizeof(arr));
}

void test2(char ch[])
{
printf("%d\n",sizeof(ch));
}

int main()
{
int arr[10] = { 0 };
char ch[10] = { 0 };
printf("%d\n",sizeof(arr));//40
printf("%d\n",sizeof(ch));//10
test1(arr);//数组传参传递的是首元素的地址 4/8字节
test2(ch);//

return 0;
}
*/

/*
int main()
{
int a = 3;//011
int b = 6;//110
int c = a && b;
int d = a || b;
printf("%d\n",c);//两个同时为真才为真,结果为真
printf("%d\n",d);//两个同时为假才为假,结果为真
return 0;
}
*/

/*
int main()
{ // i=0 a=0 b=010 c=011 d=100
int i = 0, a = 0, b = 2, c = 3, d = 4;
i = a++ && ++b && d++;
//a=a=0-->为假,不进行右边计算-->b=2 c=3 d=4
printf("a=%d\n, b=%d\n, c=%d\n, d=%d\n",a,b,c,d);

return 0;
}

*/

/*
int main()
{ // i=0 a=0 b=010 c=011 d=100
int i = 0, a = 1, b = 2, c = 3, d = 4;
//i = a++ && ++b && d++; //&&遇到假则停止 2334
i = a++ || ++b || d++; //||运算遇到真则停止 2234
printf("a=%d\n, b=%d\n, c=%d\n, d=%d\n", a, b, c, d);

return 0;
}
*/

/*
int main()
{
//int a = 0;
//int b = 0;
//if (a > 5)
// b = 3;
//else
// b = -3;
//printf("%d\n",b);

int a = 0;
int b = 0;
b = (a > 5 ? 3 : -3);
printf("%d\n",b);

int a = 10;
int b = 20;
int max = 0;
max = (a > b ? a : b);
printf("%d\n", max);
return 0;
}
*/

/*
int main()
{
int a = 1;
int b = 2;
int c = (a > b, a = b + 10, a , b = a + 1);//ca
printf("%d %d %d \n", a, b, c);

return 0;
}
*/

/*
int main()
{
int a[10] = { 0 };
a[4] = 10;
printf("%d %d\n",a[4],a[5]);
return 0;
}
*/

/*
struct student
{
char name[20];
int age;
char id[20];
};

int main()
{
int a = 10;
//使用struct student这个类型创建了一个学生对象s1,并初始化
struct student s1 = { "张三" , 20 , "20230311" };
struct student *ps = &s1;
printf("%s\n",(*ps).name);
printf("%d\n",(*ps).age);
printf("%s\n",(*ps).id);

printf("%s\n",ps->name);
printf("%d\n",ps->age);
printf("%s\n",ps->id );

printf("%s\n",s1.name);
printf("%d\n",s1.age);
printf("%s\n",s1.id);

return 0;
}
*/

/*
int main()
{ //二进制数加减用补码运算
char a = 3;//正常来说是00000000000000000000000000000011
//char中只能存放8个字节故为00000011 -a
char b = 127;//00000000000000000000000001111111
//01111111 -b
//a+b
// 00000000000000000000000000000011
// 00000000000000000000000001111111
//结果 00000000000000000000000010000010
char c = a + b;//c->10000010
//将c按符号位补全,符号位为1
//11111111111111111111111110000010 --补码
//11111111111111111111111110000001 --反码
//10000000000000000000000001111110 --原码
//-126
printf("%d\n",c);
return 0;
}
*/

/*
int main()
{
char a = 0xb6;//101101110
short b = 0xb600;
int c = 0xb6000000;
if (a == 0xb6)
printf("a");
if (b == 0xb600)
printf("b");
if (c == 0xb6000000)
printf("c");
return 0;
}
*/

/*
int main()
{//整形提升,c参与表达式运算,由1个字节变为4个字节
char c = 1;
printf("%u\n",sizeof(c));//1
printf("%u\n", sizeof(+c));//4
printf("%u\n", sizeof(!c));//1
return 0;
}
*/

/*
int main()
{
int a = 10;
int b = 20;
int c = b + a * 3;
printf("%d\n",c );


return 0;
}
*/


/*
int main()
{ //无意义,++i无顺序导致结果不确定
int i = 1;
int c = (++i) + (++i) + (++i);
printf("%d\n",c);

return 0;
}
*/