This code is just to test my knowledge on structure array access. When I executed this code it gives me the error two many initializes for param. Please help me to understand the error and fixing this problem. I was trying to reuse the code which is already solved by someone. My question about fill the Struct with parameters Param_u param
#include <iostream>
#include <stdio.h>
#include <string.h>
#define ARRAY_COUNT(arr) (sizeof (arr) / sizeof *(arr))
typedef union {
struct { // Function parameters
int *array;
size_t size;
};
struct { // Function return value
float mean;
int Median;
};
} Param_u;
int main() {
int array_1[] = {1, 2, 3, 4, 5};
int ret1, ret2;
// Fill the Struct with parameters
Param_u param = {
.array = array_1,
.size = ARRAY_COUNT(array_1),
};
return 0;
}