I am trying to pass a whole struct into a function. I don't even know if thats possible in C. This code compiles, but doesn't work. Any suggestions?
Thanks in advance.
Code:
#include <stdio.h>
#include <stdlib.h>
int UpdateThreshold(peak);
struct peak
{
double val[2];
double status[2];
double temp_val[2];
} Peak;
int main()
{
struct peak x;
x.val[1] = 3;
UpdateThreshold(x);
return 0;
}
int UpdateThreshold(struct peak v)
{
printf("x val is %d\t", v.val[1] );
return 0;
}
Thanks in advance.