Now it's like this:
void initialpos(struct atom *name, int N)
{
int i;
for (i = 0; i < N; i++)
{
name[i]->x=drand48()*20;
name[i]->y=drand48()*20;
name[i]->z=drand48()*20;
printf("pos of %d: %f\t %f\t %f\t \n", i, name[i]->x, name[i]->y, name[i]->z);
}
}
(i forgot the printf function the previous time).
Now it's complaining about 'invalid type argument of '->' '
I'll explain what i want to do.
In main() a the function initialpos() is called, to give a particle some initial position. But this position is needed later on as well, so i want to keep the values too when the function is finished.
When i did it like in the opening post, the values are written to the struct, but after the function is fnished, the elements are gone.
Hope you understand what I mean. Thanks for the help so far,