♦ Iterate Through String in C
♣ Example2: Iterate Through String in C
In this example, program will Iterate through a string to print characters. Example
Input:
xxxxxxxxxx
1
#include <stdio.h>
2
#include <string.h>
3
4
int main() {
5
6
char str[]="Hello C programmers!!";
7
8
for(int i=0; i<strlen(str); i++){
9
printf("%c", str[i]);
10
}
11
12
13
return 0;
14
}
15
Output:
1
1