When I am debugging and watching the value of the variable at input_array(),the value inputted seems to be saved. However when it comes to the main function, somehow all the inputs in the struct are gone.
#include <stdio.h>
#define MAXN 100
struct sortedArray{
int data[MAXN];
int count;
};
void input_array(struct sortedArray a){
scanf("%d", &a.count);
for (int i = 0; i < a.count; i++){
scanf("%d", &a.data[i]);
}
}
int main(){
struct sortedArray a;
input_array(a);
for (int i = 0; i < a.count; i++){
printf("%d ", a.data[i]);
}
return 0;
}