Ich habe diesen Code hier und möchte es kondensiert.Wie verkürzen? Gibt es einen Weg?
int arrayDisplay(int testScore[], int size){
printf("%d %d %d %d %d", testScore[0], testScore[1], testScore[2], testScore[3], testScore[4]);
printf("\n");
printf("%d %d %d %d %d", testScore[5], testScore[6], testScore[7], testScore[8], testScore[9]);
printf("\n");
printf("%d %d %d %d %d", testScore[10], testScore[11], testScore[12], testScore[13], testScore[14]);
printf("\n");
printf("%d %d %d %d %d", testScore[15], testScore[16], testScore[17], testScore[18], testScore[19]);
printf("\n");
printf("%d %d %d %d %d", testScore[20], testScore[21], testScore[22], testScore[23], testScore[23]);
printf("\n");
printf("%d %d %d %d %d", testScore[24], testScore[25], testScore[26], testScore[27], testScore[28]);
printf("\n");
printf("%d %d %d", testScore[29], testScore[30], testScore[31]);
printf("\n");
return 0;
}
'int * t = testScore;' dann 'printf ("% d% d% d% d% d ", t [0], t [1], ...' Kürzere bereits! Andere als das, was haben Sie versucht? Zum Beispiel haben Sie Ihr Buch auf der Seite über Schleifen geöffnet? –
Durchschnitt von 5 Frage ist -2 und keine nach 7 Monaten akzeptiert.Schlagen Sie vor, https: // stackoverflow .com/help/how-to-ask – chux