Hi, how you store a string of char in c using stdio.h and conio.h only.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
int j;
char input[26];
printf("Please enter your name: ");
do
{
input[j] = getchar();
if (input[j] == '*' || input[j] == "#")
{
printf("Name should not include * and #. Try again.");
j = 0;
continue;
}
j++;
} while (input[j] < 25 && input[j] != '\n');
input[j] = 0;
puts("Your name is");
puts(input);
}
From the example above, the program must be able to store each char and then display the name on the screen. The name must be less than 25 char and must not include * and #. From the code I used above, I cant seem to display the name on the screen. Any help is appreciated. Thanks!