C language How to print the character in a string

ww‮ual.w‬tturi.com
C language How to print the character in a string

The string ends with a white space character \0in C language

#include <stdio.h>
int main(void)
{
  //variable
  char str[] = "Hello";
  
  int i;
  
  //output
  i = 0;
  while(str[i] != '\0') {
    printf("%c\n", str[i]);
    i++;
  }
  
  printf("End of code\n");
  return 0;
}

输出

H
e
l
l
o
End of code
Created Time:2017-08-28 06:59:37  Author:lautturi