摘要:
#include <stdio.h>int main()//&取地址操作符 *--解引用操作符 { int a=10;//p的类型为int int*p=&a;//有一种变量是用来存放地址的 指针变量P printf("%p\n",&a);//0028FF40 printf("%p\n",p);//0 阅读全文
posted @ 2022-03-09 21:27
抢你红包
阅读(75)
评论(0)
推荐(0)
摘要:
#include <stdio.h>#define Max(x,y)(x>y?x:y)int main(){ int a=10; int b=20; int max=Max(a,b); printf("max=%d",max);} 阅读全文
posted @ 2022-03-05 13:24
抢你红包
阅读(37)
评论(0)
推荐(0)
摘要:
#include<stdio.h>int Max(int x,int y){ if(x>y) return x; else if (y>x) return y;}int main(){ int a=10; int b=20; int max=Max(a,b); printf("max=%d\n",m 阅读全文
posted @ 2022-03-05 13:20
抢你红包
阅读(27)
评论(0)
推荐(0)
摘要:
#include <stdio.h>void test(){ static int a=1;//没加static时int的值自动销毁,没有保存 a++; printf("%d\n",a);//结果为2,3,4,5,6, }int main(){ int i=0; while(i<5) { test( 阅读全文
posted @ 2022-03-05 11:40
抢你红包
阅读(35)
评论(0)
推荐(0)
摘要:
#include <stdio.h> int main() { auto int a=10; //局部变量 自动变量(自动销毁) printf("%d",a); return 0; } 结果为10 阅读全文
posted @ 2022-03-05 10:45
抢你红包
阅读(29)
评论(0)
推荐(0)
摘要:
#include <stdio.h>int a=0;int b=~a;int main(){ printf("%d",b);//结果为负1(要求为原码) //0为32字节为00000000000000000000000000000000 // 取反为 111111111111111111111111 阅读全文
posted @ 2022-03-04 17:25
抢你红包
阅读(448)
评论(0)
推荐(0)
摘要:
#include <stdio.h>int main(){ int a=10;//int定义的变量是有符号的 a=-2;//signed int; sign 有符号 unsigned int num=-1;//unsigned 无符号,num无符号数 printf("unsiged int=%d\n 阅读全文
posted @ 2022-03-03 21:43
抢你红包
阅读(38)
评论(0)
推荐(0)
摘要:
#include <stdio.h>int main(){ register int a=10;//建议把a定义成寄存器变量,不过因为内存有限,不建议都定义 return 0;} 阅读全文
posted @ 2022-03-03 21:35
抢你红包
阅读(41)
评论(0)
推荐(0)
摘要:
#include <stdio.h>int a=3;int b=5;int c=a&&b;int main(){ printf("%d\n",c); return 0;} 真为1;1x1=1,两个为真的数相乘结果为1 阅读全文
posted @ 2022-03-03 21:06
抢你红包
阅读(41)
评论(0)
推荐(0)
摘要:
#include <stdio.h>int a=0;int b=5;int c=a||b;int main(){ printf("c=%d\n",c); return 0;} 假的为0,真的为非零。0+1=1; 阅读全文
posted @ 2022-03-01 22:58
抢你红包
阅读(33)
评论(0)
推荐(0)