摘要: #数组 // 一组相同类型的元素的集合 //10个整型1-10存起来: int arr[10] = { 1,2,3,4,5,6,7,8,9,10 };//元素类型 空间名[元素个数]={元素} char ch[5] = { 'a','b','c' };//不完全初始化,剩余的默认为0。 阅读全文
posted @ 2022-11-08 14:49 Yeah晓夫 阅读(14) 评论(0) 推荐(0)
摘要: ##非函数方式 //#include<stdio.h> //int main() //{ // int a = 0; // int b = 0; // scanf_s("%d%d", &a, &b); // int c = a + b; // // printf("%d\n", c); // ret 阅读全文
posted @ 2022-11-08 14:37 Yeah晓夫 阅读(29) 评论(0) 推荐(0)
摘要: #循环语句 /#include<stdio.h> int main() { int a = 0; while (a < 3000) { printf("写代码:%d\n", a); a++; } if (a == 3000) { printf("好工作"); } return 0; } 阅读全文
posted @ 2022-11-07 23:02 Yeah晓夫 阅读(21) 评论(0) 推荐(0)
摘要: #选择语句 /#include<stdio.h> int main() { int a = 0;//输入值 printf("好好学习么(0/1)?\n"); scanf_s("%d\n", &a); if (a == 1) { printf("好offer\n"); } else { printf( 阅读全文
posted @ 2022-11-07 22:54 Yeah晓夫 阅读(27) 评论(0) 推荐(0)
摘要: #转义字符 ##转变字符原有意思 /#include<stdio.h> int main() { printf("c:\test\test.c"); printf("ab\nab\n"); printf("%c\n", ''');//' printf("%s\n", """);//" printf( 阅读全文
posted @ 2022-11-07 22:15 Yeah晓夫 阅读(25) 评论(0) 推荐(0)
摘要: #字符串 ##字符串就是一串字符,用双引号括起来的一串字符 ##字符数组-数组是一组形同类型的元素 /#include<string.h> /#include<stdio.h> int main() { char arr[] = "hello"; printf("%d\n", strlen(arr) 阅读全文
posted @ 2022-11-06 12:47 Yeah晓夫 阅读(20) 评论(0) 推荐(0)
摘要: #常量 ##1 字面常量 int main() { 3.14; 10; 'a'; "abcdef"; return 0; } ##2 const修饰的常变量 #include<stdio.h> int main() { const int num = 10;//num就是常变量-具有常属性(不能被改 阅读全文
posted @ 2022-11-05 22:12 Yeah晓夫 阅读(101) 评论(0) 推荐(0)
摘要: #作用域 //局部变量的作用域:就是变量所在的局部范围 //全局变量的作用域:整个工程 //跨文件变量声明:extern int 变量名 #生命周期 //局部变量生命周期:进入局部范围生命开始,出局部范围生命结束 //全局变量生命周期:程序的生命周期 阅读全文
posted @ 2022-11-05 18:49 Yeah晓夫 阅读(31) 评论(0) 推荐(0)
摘要: #定义变量 #include<stdio.h> int main() { //创建的一个变量 //类型 变量的名字=0;/推荐 //类型 变量的名字;/不推荐 int age = 20; double weight = 75.3; age = age + 1; weight = weight - 3 阅读全文
posted @ 2022-11-04 22:16 Yeah晓夫 阅读(101) 评论(0) 推荐(0)
摘要: #写代码 ###1.写出主函数(main函数) //如何执行 C语言是从主函数的第一行开始执行的 //所以C语言代码中得有main函数入口 //printf-库函数-在屏幕上打印信息的 //printf的使用,也得打招呼(引用头文件stdio.h) #include <stdio.h> int ma 阅读全文
posted @ 2022-11-04 16:55 Yeah晓夫 阅读(166) 评论(0) 推荐(0)