- 博客(8)
- 收藏
- 关注
原创 数组
数组类型 数组名【整型常量】int ar[ 5 ] = {};[ ] 内必须是 大于0的整数常量表达式//C99中 [ ] 内可以是变量int ar[5] = { 1, 2, 3, 4, 5};printf(" %d " ,sizeof( ar));输出结果为 20;char br[6] = {“hello”};printf(" %d " ,sizeof( br ));输出结果为 6 ;int ar[] = {1,2,3};int n;n = sizeof(ar)/si
2020-06-13 20:47:10 146
原创 strlen() sizeof()
int main(){int ar[5]={1,2,3,4,5};char str1[10]={“hello”};char str2[10]={‘h’,‘e’,‘l’,‘l’,‘o’};char str3[]={“hello”};char str4[]={‘h’,‘e’,‘l’,‘l’,‘o’};return 0;}因为 str1[10]={“hello”} str1[0] = ‘h’str1[1] = ‘e’str1[2] = ‘l’str1[3] = ‘l’str1[4
2020-06-12 13:23:47 101
原创 2020-06-03
逗号表达式scanf(“%d”,&n);while(n!=0){sum+=n;scanf(“%d”,&n);}可以改写为while(scanf(“%d”,&n),n!=0){sum+=n;}
2020-06-03 17:17:45 65
原创 2020-06-03
循环语句for( ; ; ) 条件可省略while(1) 每次循环都需要判断while( x ) x非0⃣️即为真x不可以省略 如果省略程序报错
2020-06-03 17:09:39 86
原创 2020-06-03
函数1.函数的声明例 bool is_leapyear (int year);year 可省略2.函数的定义Bool is_leapyear (int year){}3.函数的调用is_leapyear(year)
2020-06-03 17:03:32 90
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人