Código
int comparar(int vector1[], int n1, int vector2[], int n2) { int i; if (n1 == 0 && n2 != 0) { return -1; } if (n2 == 0 && n1 != 0) { return 1; } for(i=0;i<n1||i<n2;i++) { if(vector1[i]<vector2[i]) { return -1; } if(vector1[i]>vector2[i]) { return 1; } if(vector1[i]==vector2[i]&&n1==n2) { return 0; } } return 0; }
y me devuelve el siguiente error varias veces:
==22== Conditional jump or move depends on uninitialised value(s)
==22== at 0x400738: comparar (tp0.c:67)
==22== by 0x400DEB: prueba_comparar (tp0_pruebas.c:80)
==22== by 0x400558: main (tp0_pruebas.c:147)
==22== Uninitialised value was created by a stack allocation
==22== at 0x400B20: prueba_comparar (tp0_pruebas.c:48
Si alguien me pudiera dar una mano, estaria muy agradecido.