摘要:#include <stdio.h>#include <stdlib.h>#include <string.h> #define _CRT_SCURCE_NO_WARINGSint main(){ //const 修饰指针 int x = 10; printf("未被指针修改之前的x的值:%d \n
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h> #define _CRT_SCURCE_NO_WARINGSint main(){ //万用指针就是可以根据数据类型改变的指针类型 int a = 10; //指向了一个int类型的数据
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h> #define _CRT_SCURCE_NO_WARINGSint main(){ // 野指针就是指针指向了一个空的内存地址,所以形成了一个野指针。 // 野指针和空指针的区别就是,野
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h> #define _CRT_SCURCE_NO_WARINGSint main(){ //空指针就是指向空地址的一个指针,通常用于条件判断来使用 int *p1 = NULL; print
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h> #define _CRT_SCURCE_NO_WARINGSint main(int argc, char *argv[]){ int x = 10; int *p1 = &x; //被
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h> extern void Speaks(); //extern关键字修饰的变量和函数等,都是可以被整个项目共享调用的,所以可以使用extern函数来引入其他文件的内容,但是要把要引入的东西
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#define _CRT_SCURCE_NO_WARINGS void speak(){ printf("我很帅。。 \n"); // 无参数,无返回值的
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h>#define _CRT_SCURCE_NO_WARINGS int main(){ char add[] = "100 a"; //当字符串中有转换的数据类型的数据的时候,可以使用ato
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h>#define _CRT_SCURCE_NO_WARINGS int main(){ char add[] = {"JingsliLiu"}; printf("未使用strtok之前: "
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h>#define _CRT_SCURCE_NO_WARINGS int main(){//strchr函数就是将要查找的字符查找到之后,从查到到的地方开始,记住后面的字符。 char add
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h>#define _CRT_SCURCE_NO_WARINGS int main(){ //sscanf函数就是将字符串内的内容格式化后取出,然后装进相对的数据类型的变量中 int x=12
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h>#define _CRT_SCURCE_NO_WARINGS int main(){ // sprintf函数可以将其他类型的数据和字符类型的数据写到另一个字符串当中去,当然,必须是先字符
阅读全文
摘要:// strcmp函数是按照ASLL比较两个字符串是不是相等,并返回一个int类型的值。//返回值为负数==字符串1小于字符串2(按ASCLL码)//返回值为证书==字符串2小于字符串1(按ASCLL码)//返回值为0时==字符串1和字符串2相等(按ASCLL码) #include <stdio.h
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h> int main(){ char str1[] = "安徽粮食"; char str2[] = "工程职业学院"; strcat(str1, str2); // hello world
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h> int main(){ char arr1[] = "安徽粮食工程学院"; char arr2[100]; strcpy(arr2, arr1); printf("拷贝后的字符串是:%s
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h> int main(){ char add[20]; //输入 printf("请输入字符串的内容: \n"); gets(add); int x=strlen(add); printf(
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h> int main(){ char add[20]; //输入 printf("请输入字符串的内容: \n"); gets(add); //输出 printf("您输入的字符串的内容是:
阅读全文
摘要:#include <stdio.h>#include <stdlib.h> int main(){ int add[2][3][4] = { {{1,2,3,4},{5,6,7,8},{9,10,11,12}}, {{13,14,15,16},{17,18,19,20},{21,22,23,24}}
阅读全文
摘要:#include <stdio.h>#include <stdlib.h> int main(){ int add[3][3] = { {1,2,3},{4,5,6},{7,8,9} }; for (int x = 0; x < 3; x++) { for (int i = 0; i < 3; i+
阅读全文
摘要:#include <stdio.h>#include <stdlib.h> int main(){ int add[] = { 1,256,12,621,62,3462,6,89999,87}; int g=sizeof(add) / sizeof(add[0]); printf("add数组的长度
阅读全文
摘要:#include <stdio.h>#include <stdlib.h> int main(){ int add[] = { 1,256,12,621,62,3462,6,89999,87}; int Max=add[0]; int Mini; for (int x = 0; x < g; x++
阅读全文
摘要:#include <stdio.h>#include <stdlib.h> int main(){ int add[] = { 1,2,51,6,16,1 }; // 静态创建1 int arr[2]; // 静态创建2 arr[0] = 12; arr[1] = 25; arr[2] = 100;
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <time.h> int main(){ int x = 0; srand((unsigned)time(NULL)); x = rand() %10; printf("产生的随机数是:%d \n", x);
阅读全文
摘要:#include <stdio.h>#include <stdlib.h> int main(){ int i=0; for (i = 1; i <= 10; i++) { if (i == 3) { break; } printf("%d\n", i); } printf(" \n"); int
阅读全文
摘要:#include <stdio.h>#include <stdlib.h> int main(){ int i, j; for (i = 1; i <= 9; i++) { for (j = 1; j <= i; j++) { printf("%d*%d=%d ", i, j, i * j); }
阅读全文
摘要:#include <stdio.h>#include <stdlib.h> int main(){ int x = 10; goto END; x == 20;END: printf("x的值是:%d \n", x); system("pause"); return 0;}
阅读全文
摘要:#include <stdio.h>#include <stdlib.h> int main(){ int x = 4; int y = x > 10 ? 100 : 2000; printf("y的值是:%d。\n", y); system("pause"); return 0;}
阅读全文
摘要:#include <stdio.h>#include <stdlib.h> int main(){ for (int x = 0; x < 10; x++) { printf("第%d次循环。 \n", x); } system("pause"); return 0;}
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> int main() { int x=0; do{ x++; printf("第%d次循环。",x); }while(x<10); system("pause"); return 0; }
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> int main() { int x=0; while(x<10){ printf("第%d次循环。 \n",x); x++; } system("pause"); return 0; }
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> int main() { int x=2; switch(x){ case 1: printf("x的值是1"); break; case 2: printf("x的值是2"); break; case 3: printf
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> int main() { int x=12; if(x>10){ printf("x的值大于10 \n"); }else if(x<10){ printf("x的值小于10\n"); } system("pause");
阅读全文