Cześć,
Odkrywając dzisiaj kolejne tajniki języka C natrafiłem na taki oto problem... Dodam iż problem występuje na Microsoft Visual studio 2013 Express
#include <stdio.h>
#include <stdlib.h>
typedef struct{
int numerek;
int cyfra;
}struktura;
void printStruct(struktura f);
int main(){
struktura myStruct;
myStruct.numerek = 1;
myStruct.cyfra = 3;
struktura otherStruct;
otherStruct.numerek = 2;
otherStruct.cyfra = 5;
struktura fArray[] = { myStruct, otherStruct };
for (int i = 0; i < 2; i++)
printStruct(fArray[i]);
getchar();
return 0;
}
void printStruct(struktura f){
printf("%i/%i\n", f.numerek, f.cyfra);
}
VS krzyczy mi że: error C2440: 'initializing' : cannot convert from 'struktura' to 'int' ....(w instrukcji FOR)
jak inicjuje zmienną poza pętlą FOR to jest w porzadku, inicjując w FOR jest taki problem...
Prosze o pomoc.
Pozdrawiam,
Mateusz