主函数

int main(int argc,char * argv[]) -- arg代表英文的参数缩写 c代表count计数 argc

{

  return 0;  -- 0返还给系统,代表程序正确运行

}

int i;

for(i=0;i<argc;i++)

{

printf("%s\n",argv[i]);

}

./a.out 123 678 opq

结果 123 678 opq

求两个数的和,最小值

t1.h
int add(int a,int b); t2.h
int min(int a,int b); add.c
#include"t1.h"
int add(int a, int b)
{
ruturn (a+b);
} min.c
#include"t2.h"
int min(int a ,int b)
{
return (a-b);
} main.c
#include<stdio.h>
#include"t1.h"
#include"t2.h"
main()
{
int x= ;
int y=;
printf("%d\n",add(x,y));
printf("%d\n",min(x,y));
} makefile 文件
main: main.o add.o min.o
   gcc -o main main.o add.o min.o
main.o: main.c add.c min.c
     gcc -c main.c
add.o: add.c t1.h
    gcc -c add.c
min.o: min.c t2.h
    gcc -c min.c

实现 cp 功能 x代替 cp x test.c test1.c

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int argc,char *argv[])
{
FILE *in,*out;
char ch;
int i,k;
if(argc<)
{
printf("please input\n");
}
else {
if((in=fopen(argv[],"rb"))==NULL) {
printf(can not open);
exit();
}
}
if((out=fopen(argv[]),"wb")==NULL) {
printf("can not open");
exit();
}
ch=fgetc(in);
while(feof(in)==) {
fputc(ch,out);
ch=fgetc(in);
}
fclose(in);
fclose(out);
return ;
}

简单的c语言小程序 回光返照的更多相关文章

  1. 通过反汇编C语言小程序学习Liunx汇编语言

    大家好!    我是来自山东师范大学的吴乐.    今天在<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 ...

  2. Linux下简单C语言小程序的反汇编分析

    韩洋原创作品转载请注明出处<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 写在开始,本文为因为参加MOO ...

  3. c语言小程序以及java生成注释文档方法

    c语言小程序:sizeof和strlen() sizeof运算符以字节为单位给出数据的大小,strlen()函数以字符为单位给出字符串的长度,字符和字节不是一回事. char类型用于存储字母和标点符号 ...

  4. C语言小程序——推箱子(窄字符和宽字符)

    C语言小程序——推箱子(窄字符Version) 推箱子.c #include <stdio.h> #include <conio.h> #include <stdlib. ...

  5. Linux C语言小程序

    Linux C语言小程序 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include & ...

  6. Netty学习——基于netty实现简单的客户端聊天小程序

    Netty学习——基于netty实现简单的客户端聊天小程序 效果图,聊天程序展示 (TCP编程实现) 后端代码: package com.dawa.netty.chatexample; import ...

  7. Winfrom 简单的进度条小程序

    使用Winform空间编写简单的进度条小程序: 所需控件:Lable 标签  TextBox  文本框  progressBar  进度条控件  timer 定时器 下面是源码及效果图: /// &l ...

  8. 自动生成.py文件头部的C语言小程序

    每次都 vi xxx.py 然后再打 #!/usr/bin/env python 等等的程序头信息感觉有点麻烦,于是便想着写一个小程序自动生成这些头信息了,顺便在 ~/.bashrc 里写入 alia ...

  9. c语言小程序

    这是一个用c语言写的小程序,功能是随机输出30道100以内的四则运算,先生成两个随机数,再通过随机数确定四则运算符号,最后输出题目. #include<iostream> using na ...

随机推荐

  1. edittext SearchView 失去焦点问题

    edittext 默认自己主动获取焦点的 并且会出现小键盘非常烦人 <LinearLayout             android:id="@+id/focus"     ...

  2. 倍福TwinCAT(贝福Beckhoff)常见问题(FAQ)-如何查询某个变量的ADS地址

    鼠标放到任意一个参数上停留一段时间,会自动弹出关于该条参数的ADS信息   TC3也是一样(如果不是轴的某个参数而是PLC程序绑定的某个变量也是一样,定位到这个变量既可以看到ADS信息)       ...

  3. python abstractmethod 对象比较

    from functools import total_ordering from abc import ABCMeta,abstractmethod @total_ordering class Sh ...

  4. Python——实现代理服务功能

    代理服务原理很简单,就拿浏览器与web服务器来说.无非是A浏览器发request给B代理,B代理再把request把送给C web服务,然后C的reponse->B->A.要写web代理服 ...

  5. git 基于某个分支创建分支

    1.拷贝源代码 git clone git@git地址 cd 项目目录 2.根据已有分支创建新的分支 git checkout -b yourbranchname origin/oldbranchna ...

  6. linux之getopt 函数(转)

    命令行参数解析函数 —— getopt() getopt()函数声明如下: #include <unistd.h> int getopt(int argc, char * const ar ...

  7. 51单片机 | 1-Wire总线及应用实例

    ———————————————————————————————————————————— 1-Wire总线 - - - - - - - - - - - - - - - - - - - - - - - ...

  8. WebUI中 DataGrid多层表头 的终极解决办法

    因为DataGrid控件的简单易懂,大多数做.NET程序员都喜欢用,有需要把数据显示成表格样式的地方DataGrid会是首选,但是所有的东西都会有好和不好的一面,DataGrid在给我们带来了数据显示 ...

  9. git merge rebase的区别及应用场景

    前两天和同事交流发现他在日常开发中跟上游保持同步每次都是用git pull操作,而我一直习惯git fetch然后rebase,发现这两种操作后的log是有些区别的.他每次pull操作之后都会自动生成 ...

  10. 千万级大数据的Mysql数据库SQL语句优化

    1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索 ...