〖C语言〗C语言一个函数传递无限制多参数(不确定参数函数)的方法

/*
 * =====================================================================================
 *
 *       Filename:  multi.c
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  Wednesday, July 17, 2013 02:26:11 HKT
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  linkscue (scue), 
 *   Organization:  
 *
 * =====================================================================================
 */

#include    <stdio.h>
#include    <stdlib.h>

void multi ( int argc, char *argv[] );
/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  main
 *  Description:  
 * =====================================================================================
 */
int main ( int argc, char *argv[] )
{
    char *margv[] = {"one", "two", "three", "four", NULL};
    multi(4, margv);
    return EXIT_SUCCESS;
}


/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  multi
 *  Description:  
 * =====================================================================================
 */
    void
multi ( int argc, char *argv[] )
{
    printf("argv1 = %s\n", argv[0]);
    printf("argv2 = %s\n", argv[1]);
    printf("argv3 = %s\n", argv[2]);
    printf("argv4 = %s\n", argv[3]);
//    return <+return_value+>;
}        /* -----  end of function multi  ----- */

posted @ 2013-07-17 14:39  scue  阅读(3214)  评论(0编辑  收藏  举报