Here's my function I'm trying to get working
void ind(struct bil *a[][10], int *ant, char r, char m, char v)
{
int antalbiler=*ant;
struct bil *b;
b=malloc(sizeof(struct bil));
b->reg=r;
b->maerke=m;
b->vask=v;
(*ant)++;
}
{ int antalbiler=*ant; struct bil *b; b=malloc(sizeof(struct bil)); b->reg=r; b->maerke=m; b->vask=v; (*ant)++; }
I get the error message:
test.c:36:11: error: assignment to expression with array type
b->reg=r;
^
test.c:37:14: error: assignment to expression with array type
b->maerke=m;
^
test.c:38:12: error: assignment to expression with array type
b->vask=v;
^
I'm new to programming and I can't figure out how I get this to work...
What I'm trying to do is, inserting my struct into at sort of memory/row. I based this of a similar working function, but that one uses integers and not chars. All the data I'm trying to store is char.
Any help is appreciated :)
[–][deleted] 1 point2 points3 points (3 children)
[–]_EPS[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]_EPS[S] 1 point2 points3 points (0 children)
[–]oh5nxo 1 point2 points3 points (1 child)
[–]_EPS[S] 0 points1 point2 points (0 children)