Help me in solving CLB109 problem

My issue

include <stdio.h>

int main(void) {
// your code goes here

char x[] = {'C','O', 'D','I', 'N', 'G'};

// Iterate through the array and print the index and the element
for (int i = 0; x[i] != '\0'; i++) {
    printf("Index number %d\n", i);
    printf("element %c\n", x[i]);
}
return 0;

}

what’s wrong ?

My code

#include <stdio.h>

int main(void) {
	// your code goes here
	
	char x[] = {'C','O', 'D','I', 'N', 'G'};

    // Iterate through the array and print the index and the element
    for (int i = 0; x[i] != '\0'; i++) {
        printf("Index number %d\n", i);
        printf("element %c\n", x[i]);
    }
	return 0;
}


Learning course: Learn C
Problem Link: CodeChef: Practical coding for everyone

@mystery_24

u have to do it like this

#include <stdio.h>

int main() {

  char x[6] = {'C', 'O', 'D', 'I', 'N', 'G'};
  for(int i = 0; i < 6; i = i + 1) {
    printf("%d = %c\n", i, x[i]);
  }

  return 0;
}