Help me in solving CLB058 problem

My issue

why charx[10]

My code

#include <stdio.h>

int main(void) {
	char x[10];
	scanf ("%s",&x);
	printf("Hello %s",x);
	
	return 0;
}


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

@ananyashinde24
char x[10] is the string.

@ananyashinde24

  • Here we take the character data type i.e. char data type to print the strings.
  • In the above code char x[10] >> char is the data type and x is the variable and in the bracket we are putting 10 which means it can hold data up to 10 characters or we say it can accept a string up to 10 characters length .