
15个回答
展开全部
当然有了,可以很好的打下基础啊
,C语言是最基本的
计算机编程语言,如果没学好就很难编程了
,C语言是最基本的
计算机编程语言,如果没学好就很难编程了
展开全部
所有编程语言的基础,学好C语言可以学习任何语言。基础中的基础,就和你学习跑步先得学会走一样!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
确切说不但是基础,也是非常好用的工具,看看下面的程序,如果你能看懂,那么你的C和其它编程方面的知识就达到一定的程度了
#include "stdio.h"
#include "unistd.h"
int main() {
pid_t child_b, child_c;
int pipefds[2]; //[0] for read, [1] for write
char * arg1[] = {"/usr/bin/wc", NULL};
char * arg2[] = {"/bin/ls", "-l", NULL};
//父进程
pipe(pipefds); // 开始创建管道的2段
if(!(child_b = fork())) { //创建子进程b
close(pipefds[1]); /* 关掉管道的读取端*/
close(0); //关掉b进程的标准输入文件,其实就是键盘
dup2(pipefds[0], 0); //将我们管道的输出段复制到 b进程的标准输入中
close(pipefds[0]); //关掉输出
execve("/usr/bin/wc", arg1, NULL); //执行wc进程
printf("pid is %d, wc\n", getpid()); //只有出错才会到这里
}
close(pipefds[0]); /*close read*/
if(!(child_c = fork())) { //创建子进程c
close(1); //和上面雷同
dup2(pipefds[1], 1);
close(pipefds[1]);
execve("/bin/ls", arg2, NULL);
printf("pid is %d, ls\n", getpid());
}
close(pipefds[1]);
wait4(child_b, NULL, 0, NULL);
return 0;
}
#include "stdio.h"
#include "unistd.h"
int main() {
pid_t child_b, child_c;
int pipefds[2]; //[0] for read, [1] for write
char * arg1[] = {"/usr/bin/wc", NULL};
char * arg2[] = {"/bin/ls", "-l", NULL};
//父进程
pipe(pipefds); // 开始创建管道的2段
if(!(child_b = fork())) { //创建子进程b
close(pipefds[1]); /* 关掉管道的读取端*/
close(0); //关掉b进程的标准输入文件,其实就是键盘
dup2(pipefds[0], 0); //将我们管道的输出段复制到 b进程的标准输入中
close(pipefds[0]); //关掉输出
execve("/usr/bin/wc", arg1, NULL); //执行wc进程
printf("pid is %d, wc\n", getpid()); //只有出错才会到这里
}
close(pipefds[0]); /*close read*/
if(!(child_c = fork())) { //创建子进程c
close(1); //和上面雷同
dup2(pipefds[1], 1);
close(pipefds[1]);
execve("/bin/ls", arg2, NULL);
printf("pid is %d, ls\n", getpid());
}
close(pipefds[1]);
wait4(child_b, NULL, 0, NULL);
return 0;
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
为你以后想从事编程行业打下基础,所以你应该好好学习一下!!!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
第一,学的是一种编程思想
第二,是学一切语言的基础
第二,是学一切语言的基础
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询