c语言main函数调用子函数后,怎么获取子函数的返回值/数组 ?

如题所述

获取子函数的返回值/数组如下:

一、如果只有一个值要返回,那么用返回值

    char * ptr。

    int SIZE = 1024。

    ptr = subFunc()。

    int a=fun()。

    int fun()。

    fun(int a[], int size)。

    if (null != (ptr_cmp = malloc(SIZE+1))。

    memcpy(ptr_cmp, array_tmp, SIZE)。

二、数组是用循环达到依次赋值的目的

    char * subFunc()。

    *ptr_cmp = '\0'。

    return ptr_cmp。

    char * subFunc()。

    char * ptr_tmp。

    int  array_tmp[1024] = {}。

    void fun(int *a)。

温馨提示:答案为网友推荐,仅供参考
相似回答