As I wrote in subject, I am getting conflicting types error when I try to pass pointer to the struct, delcared using array of structs. Have you got any suggestions to remove this error? What I am missing?
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#define N 10
void count_length(struct abc *_el);
struct vector {
double x;
double y;
};
struct abc {
struct vector vec;
double length;
};
int main(void)
{
struct abc set[N];
srand(time(NULL));
for(int i=0; i<N; i++)
{
set[i].vec.x = rand();
set[i].vec.y = rand();
count_length(&set[i]);
}
}
void count_length(struct abc *_el)
{
for(int i=0; i<N; i++)
_el->length = sqrt(pow(_el->vec.x, 2.0) + pow(_el->vec.y, 2.0));
}