C语言字符串

#include stdio.hint main() {char ch[5] = Hello;int i = 0;/* Print as a complete string */

编程学习网为您整理以下代码实例,主要实现:C语言字符串,希望可以帮到各位朋友。

#include <stdio.h>

int main() {

   char ch[5] = "Hello";
   int i = 0;

   /* Print as a complete string */
   printf("String = %s\n", ch);  

   /* Print character by character */
   while( i < 5 ) {
      printf("ch[%d] = %c\n", i, ch[i] );
      i = i + 1;
   }
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐