函数定义的有关问题。

函数定义的问题。。
C/C++ code

int main(int argc, char *argv[]){
        int n,j;
        FILE *fp;
/*      fp = fopen("x.log", "r");       
        pid_t cd;
        cd = fork();
        if(cd < 0){
                printf("fork error\n");
                exit(1);
        }else if(cd == 0){
*/

        pid_t child ;
        int fd;

/*

        if(argc < 3){
                printf("command-line argument required\n");
                return 1;
        }
*/
        char ip[32];
        strcpy(ip, argv[1]);
        if((child=fork()) < 0){
                printf("fork error\n");
                exit(1);
        }else if(child == 0){
                //child
                fd = open("x.log", (O_RDWR|O_CREAT|O_APPEND), 0644);
                dup2(fd, 1);
                if(execlp("/usr/local/nagios/libexec/check_nrpe", "check_nrpe", "-H", ip, "-c", argv[2], NULL) < 0)
                        printf("execlp error\n");
                close(fd);
        }

        char s[100];
        fp = popen("awk \'END{print}\' x.log", "r");
        while(fgets(s, 99, fp)!= NULL && s[1]!= '\n')
//              fputs(s,stdout);
                        ;

        exit(0);
}



请问下
C/C++ code
char ip[32];
        strcpy(ip, argv[1]);
        if((child=fork()) < 0){
                printf("fork error\n");
                exit(1);
        }else if(child == 0){
                //child
                fd = open("x.log", (O_RDWR|O_CREAT|O_APPEND), 0644);
                dup2(fd, 1);
                if(execlp("/usr/local/nagios/libexec/check_nrpe", "check_nrpe", "-H", ip, "-c", argv[2], NULL) < 0)
                        printf("execlp error\n");
                close(fd);
        }

这部分我想另外做个函数该怎么定义呀?新手轻喷。。。

------解决方案--------------------
探讨

说复杂了。其实我的意思可以这么理解,就是说,整个函数我要在别处调用的话,这个函数形参该怎么定义。
这里是int main(int argc, char *argv[]),但要是在别处用的,这样肯定不行。再比如说我想讲这个函数改名叫send,int send();()里面改如何定义的???

------解决方案--------------------
反过来问问LZ(因为不太清楚LZ在问什么),如果我想定义一个“两个数求和”这样一个功能,函数应该怎么声明和定义?