C远航
一夜落尽梧桐雨
这个作者很懒,什么都没留下…
展开
-
动态内存分配涉及到的二级指针,传递相关
今天看了《Linux C程序设计王者归来》动态内存管理一节。发现了一个很容易犯错的地方,特写此博客,以作总结。 正确的代码如下:#include<stdio.h> #include<stdlib.h>void f1(int **p) { *p = (int *)malloc(sizeof(int)); }void f2(int *p) { printf(ht"The heap i原创 2017-06-10 21:52:29 · 488 阅读 · 0 评论 -
exec函数簇
函数声明 包含头文件 #include <unistd.h> execl int execl(const char *path, const char *arg, ... /* (char *)NULL */); execlp int execlp(const char *file, const char *arg, ... /* (char *)NULL */); execle in原创 2017-06-12 11:38:05 · 600 阅读 · 0 评论 -
C 语言实现字符串倒序
#include <stdio.h> #include <stdlib.h> #include <string.h> int reverse_string(char *src_str, char *dst_str) { int length = 0; int i = 0; if(src_str == NULL || dst_str ==...原创 2019-06-19 11:05:42 · 545 阅读 · 0 评论