Code:
void main( void )
{
...
}
Main should always return an int.
Code:
char Letter, sentence[50];
int counter1, counter2;
printf("Type a sentence and press enter to stop:\n");
for ( counter1 = 0; counter1 < 50 && ( Letter = getche() ) != '\r'; counter1++ )
{
sentence[ Teller1 ] = Letter;
}
sentence[ counter1 ] ='\0'
What is Teller1? The getche() function is not standard. That whole for loop is the reason a function like fgets exists.
Code:
printf("\nYou typed in the following sentence: \n");
for ( counter2 = 0; counter2 < counter1; counter2++ )
{
printf("%s", sentence);
printf????????? ASCIIII??????
}
Using the %s format specifier would print the entire sentence beginning to end, you would not need a loop unless it was your goal to print the same thing over and over again. Printing the ASCII value would however require a loop which you've already been shown how to do.
Code:
printf("\npress enter to quit...");
while ( getch() != '\n' );
Like getche(), the getch() function is also not standard.