The problem with "after executing it will only prints first string only
and the rest of output vanishes" is:
The scanf() '%s' format string tells scanf to read in a string, but only
up to the first space. Hence, if you enter:
"Hello 12345 WoRlD"
The scanf("%s", s) will copy only "Hello" into 's'.
To fix this, change:
fgets(s, sizeof(s), stdin);
However, fgets() may leave a unwanted '
' at the end of the string. The unwanted '
' can be eliminated by inserting the following code after the fgets():
*q = ' ';
Then the output will be:
"hELLO 12345 wOrLd"
See my version 'casechange()', which will also reverse the number.