I'm learning C, but I find those vague compiler error messages increasingly frustrating. Here's my code:
char getkey (int minimo, int maximo, int alphalen, int index, char alpha[])
{
int cociente, residuo, cont;
int i = 0;
char cand[maximo+1];
char candidate[maximo+1];
while (index != 0)
{
cociente = index / alphalen;
residuo = index%alphalen;
cand[i] = residuo;
index = cociente;
i+=1;
}
for (cont=i-1; cont>=0; cont--)
{
int pos = cand [cont];
candidate[i] = alpha[pos];
}
return candidate;
}
This generates one warning:
- return makes integer from pointer without a cast
- return candidate;
Can someone explain these warning?