use char array as string
#include <stdio.h>
int main( )
{
char szmode1[4], /* car */
szmode2[6]; /* plane */
static char szmode3[5] = "ship"; /* ship */
szmode1[0] = 'c';
szmode1[1] = 'a';
szmode1[2] = 'r';
szmode1[3] = '\0';
printf("\n\n\tPlease enter the mode > plane ");
scanf("%s",szmode2);
printf("%s\n",szmode1);
printf("%s\n",szmode2);
printf("%s\n",szmode3);
return(0);
}
Related examples in the same category