Solution for Exercise 17-4
ex1704
#include <stdio.h>
int main()
{
char input[64];
int ch;
int x = 0;
printf("Type in ALL CAPS: ");
fgets(input,63,stdin);
while(input[x] != '\n')
{
ch = input[x] | 32;
putchar(ch);
x++;
}
putchar('\n');
return(0);
}
Notes
* I actually caught myself declaring the ch variable as a char when I first wrote this code. The putchar() function requires an int value, not a char. The code compiles when you declare ch as a char, but it should be an int.
Copyright © 1997-2025 by QPBC.
All rights reserved
