- 博客(5)
- 收藏
- 关注
转载 [C/C++]C语言中数据在内存中的存储
数据类型:类型可以归类为 整形家族(包括int,long,short,long long,char); 浮点数家族(包括float,double); 构造类型(数组类型;结构体类型 struct;枚举类型 enum;联合类型 union); 指针类型..
2021-03-15 14:28:47
272
原创 c语言关键字 const
c语言关键字 const 总结一个变量使用const修饰,该变量的数据可以被访问,不能被修改。const int a=0; //a 不能修改int const a=0; //a 不能修改const int a[2]={1,2}; //a[]不能修改const int *p; // p不能修改,不能通过p修改内容int * const p; //p不能修改 p不能再指向其他地址const struct devices ch[0]; //ch[0
2020-11-23 21:02:40
80
原创 c语言 关键字 static
c语言 关键字 static 总结1.修饰全局变量,改变变量的作用域,使只作用于本文件2.修饰函数,改变变量的作用域,使只作用于本文件3.改变变量生命周期,直至程序运行结束才释放(存放区域不同)#include <stdio.h>void test(){int num = 0;num++;printf("%d ", num);}int main(){int i = 0;for (i = 0; i < 10; i++){test();}return 0;
2020-11-23 20:53:16
47
原创 c语言 关键字 extern
c语言 关键字 extern 总结*一、extern声明外部变量:将作用域扩展到多个在这里插入代码片.//文件a.c#include <stdio.h>int function=2; //变量定义int ch(int x); //外部函数提前声明int main(int argc, char *agrv[]){ int a=10; printf("%d^%d = %d\n",
2020-11-23 20:44:18
157
原创 字符串反转
字符串反转的代码:#include <stdio.h>#include <stdlib.h>#include <string.h>int main(){ char *s = (char *)malloc(sizeof(char) * 32); // scanf("%s", s); char *begin = s; //记录字符串的起始位置 char *p = s; //p = s + strlen(s) - 1; while (*p
2020-11-14 22:19:35
88
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人