I'm passing 3 parameters: a vector with the names of 30 cities, one with the x coordinates of the respective cities and the other with the y coordinates.
I need to print on the screen the cities to the north, south, etc. I'm still testing. I am trying to assign the value of the city to the variable char cidade
that I created (it only has 3 indexes because it will be used in the tiebreaker).
However, I'm having an error:
"error: incompatible types when assigning to type 'char [150]' from type 'char *'" and wanted to know what the problem was.
void funcao(char cidadeXY[][150], int coordenadasX[], int coordenadasY[])
{
int i;
struct
{
int norte, sul, leste, oeste, centro;
char cidade[150];
}d[30];
for(i = 0; i < 30; i++);
{
d[i].cidade = cidadeXY[i];
printf("%s\n", d[i].cidade);
}
}
As requested, declarations and the function call:
char cidadeXY[30][150];
void funcao(char cidade[][150], int coordenadasX[], int coordenadasY[])
funcao(cidadeXY, coordenadasX, coordenadasY);
The code is great and a lot of it has nothing to do with this function, so I just put the declarations and the call.