[Solved] Declare a string/word variable in C [closed]

[ad_1]

char name[30]; /* pre-allocated memory of stack */

Then scan that value in.
or

char *name = malloc(sizeof(char) * 30); /* run-time allocation on heap */

I am just using 30 here assuming the input string fits in 30 char’s you can increase or decrease it , it is up to your wish.

9

[ad_2]

solved Declare a string/word variable in C [closed]