如何total在C语言中将数组X和Y的元素包含在数组中?你能用一个例子来表示吗?
X = (float*) malloc(4);
Y = (float*) malloc(4);
total = (float*) malloc(8);
for (i = 0; i < 4; i++)
{
h_x[i] = 1;
h_y[i] = 2;
}
//How can I make 'total' have both the arrays x and y
//for example I would like the following to print out
// 1, 1, 1, 1, 2, 2, 2, 2
for (i = 0; i < 8; i++)
printf("%.1f, ", total[i]);
Run Code Online (Sandbox Code Playgroud) 假设您有一个数组a[]=1,2,4,6和一个第二个数组b[]=3,5,7.合并后的结果应该包含所有值,即c[]=1,2,3,4,5,6,7.合并应该在不使用函数的情况下完成<string.h>.