C++函数之间的参数传递

int List(int *a,int *b){…
a=1,b=2
}

int Initlist(int *c,int *d){…}

如果希望让*a=c,b=*d,应该怎么做

"如果希望让a=c,b=d,应该怎么做" 要求可能是错误的,因为c是int类型,一个指针,而a 是int类型。

另外,你写的代码也有很大问题,很多地方写得不正确。
下面是我根据你的意思,写的一个C风格的table。

#include <iostream>
using namespace std;

static const int kTableInitSize = 100;
struct table {
    int size; //顺序表的容量大小(形参) 
    int length;  //顺序表的有效长度,及数组中的元素个数 
    int* head;//动态数组 
};

table InitList(table& t) { // 这里必须引用传值
    int n;
    cout << "输入n的值:"; 
    cin >> n;

    // 确保数组有足够空间
    if (n < kTableInitSize)
        t.head = new int[kTableInitSize];
    else
        t.head = new int[n + kTableInitSize];

    // 手动输入table的n个值
    for (int i = 0; i < n; ++i) {
        cout << "输入第" << i + 1 << "个数据:";
        cin >> t.head[i]; 
        t.length++;
    }
}

void DestroyList(table& t) { // 销毁table
    delete[] t.head;
}

void PrintList(table& t) { // 打印table
    cout << "{";
    for (int i = 0; i < t.length; ++i) {
        cout << t.head[i];
        if (i < t.length - 1)
            cout << ", ";
    }
    cout << "}" << endl;
}
int main()
{
    table t;
    InitList(t);
    PrintList(t); 
    DestroyList(t);
    return 0;
}

int List(int* a,int* b, int* c,int* d) {
    
    *a = *c;
    *b = *d;
}