Help me in solving USRR3 problem

My issue

What is the significance of the size of the array here? The code works perfectly for all the sizes which are non negative integers… Like the word “Chef” has 4 letters but the code works for sizes 0,1,2,3 also and an error shows up when the size is not written

My code

#include <stdio.h>

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

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

Because in C, you have to either allocate an array with a fix size or dynamically allocate one.

what do you mean by dynamically allocating size with an array?

We can fix a size of array during initialization, let’s say 10.

int a[10];

This is mainly used when we know the size requirements beforehand.

On the other hand, if we are not sure about the required size, or if the user will input the size, we can allocate it dynamically using malloc or calloc as;

a = (int*) malloc(n * sizeof(int)); // *n* user input

You should refer to this link for further clarification.

Dynamic Array