用指针跟循环(for与while)打印10名同学的名字
1 #include "stdio.h" 2 void main() 3 { 4 int i; 5 char *ar[10]={"梁锦杰","徐景祥","黎明忠","陈路", 6 "李伟杰","沈志军","杨嘉辉","周有靖","王文森","岑立宾"}; 7 printf("使用for循环结果:\n"); 8 for(i=0;i<10;i++) 9 { 10 printf("%s\n",*(ar+i)); 11 } 12 printf("使用while循环结果:\n"); 13 i=0; 14 while(i<10) 15 { 16 printf("%s\n",*(ar+i)); 17 i++; 18 } 19 }