会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Axuanup
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
2020年4月6日
字符串函数实现
摘要: #include<stdio.h> int strlen(char* p);//获取字符串的长度 void strcpy(char* des, char* src); //字符串拷贝 char strcat(char* des, const char* stc); //字符串拼接 //字符串拷贝 v
阅读全文
posted @ 2020-04-06 17:06 Axuanup
阅读(233)
评论(0)
推荐(0)
2020年4月3日
while、do...while...for循环语句
摘要: 1 #include<stdio.h> 2 void loop_a(void); 3 void loop_b(void); 4 void loop_c(void); 5 void loop_d(void); 6 7 8 void loop_a() 9 { 10 int i = 0; 11 while
阅读全文
posted @ 2020-04-03 23:09 Axuanup
阅读(258)
评论(0)
推荐(0)
浅拷贝和深拷贝问题
摘要: #include <stdio.h> int main(int argc, char *argv[]) { int x = 2; int y = x; int* p1 = &x; int* p2 = p1; printf("只拷贝值,不拷贝地址\n"); printf("深拷贝:x = %p,val
阅读全文
posted @ 2020-04-03 22:40 Axuanup
阅读(167)
评论(0)
推荐(0)
指针遍历数组时用法
摘要: int arr[5] = {1,2,3,4,5}; int *p = arr; for(int i = 0; i < 5;i++) { arr[i] = 表示数组元素0 *(p+i) = 表示指针元素0 *p+i = 表示指针元素0 p[i] = 表示指针元素0 p++ = 表示指针元素0 }
阅读全文
posted @ 2020-04-03 22:37 Axuanup
阅读(725)
评论(0)
推荐(0)
一维数组和指针
摘要: #include<stdio.h> int main(void) { int arr[] = { 1, 2, 3, 4, 5, 6 }; //arr数组名本身就是一个指针 int *p = arr; //int *p = &arr[0]; //和int *p = arr; 是等价的 for (int
阅读全文
posted @ 2020-04-03 22:36 Axuanup
阅读(318)
评论(0)
推荐(0)
用sizeof获取数组大小
摘要: 1 #include<stdio.h> 2 int main(void) 3 { 4 int arr[] = {1,2,3,4,5,6,7,8}; 5 int i; 6 for(i = 0;i < sizeof(arr)/sizeof(arr[0]);i++) 7 { 8 printf("arr[%
阅读全文
posted @ 2020-04-03 22:33 Axuanup
阅读(3951)
评论(0)
推荐(0)
2020年3月30日
c语言变量的交换
摘要: 1 #include<stdio.h> 2 void swap1(int a,int b); //利用异或交换变量的值,值传递 3 void swap2(int* a,int* b); //利用异或交换变量的值,地址传递,这里用指针* 4 5 6 void swap1(int a,int b) /*
阅读全文
posted @ 2020-03-30 21:59 Axuanup
阅读(539)
评论(0)
推荐(1)
上一页
1
2
公告