我想在使用 a[0] 的地方增加。类似的东西a++
。我能想到的唯一其他解决方案是 switch case 或一堆 if/else if 语句,但这似乎效率低下。这可能吗?
#include <stdio.h>
int
main(void)
{
const char *a[6];
a[0]="one";
a[1]="two";
a[2]="three";
a[3]="four";
a[4]="five";
a[5]="six";
for (int i = 0; i < 6; i++)
{
printf("This old man, he played %s\nHe played knick-knack on my thumb\nKnick-knack paddywhack, give your dog a bone\nThis old man came rolling home\n\n", a[0]);
}
}