CJCoding With Joseph
15per day
← Back to Question List
C Code Walkthrough #10

String Traversal with Null Terminator

easyLoops

📄 Code

Read carefully — what does this print?
1#include <stdio.h>
2 
3int main() {
4 char str[] = "Hello";
5 int count = 0;
6 int i = 0;
7 while (str[i] != '\0') {
8 count++;
9 i++;
10 }
11 printf("%d\n", count);
12 return 0;
13}

🎯 Your Answer

← Previous