Question: Complete the hw1.c so that it will count the input characters and print out the number. The while loop condition is smilar to getchar_2.c, but

Complete the hw1.c so that it will count the input characters andprint out the number. The while loop condition is smilar to getchar_2.c,Complete the hw1.c so that it will count the input characters and print out the number. The while loop condition is smilar to getchar_2.c, but it has an extra condition c != , which means pressing Enter also stops the while loop. Once you complete the program, running command gcc hw1.c -o hw1 && ./hw1 * * Counts the number of the input characters. * Print the size of C types #include * Project: hw1 * Author: * Email: * Date: * Notes: include int main(void) { char c; int i; short s; long l; long long ll; float f; double di signed int si; unsigned int usi; nt main(void) { int c; // Define an int varaible with initial value as O to count the characters. // The while loop exits when Enter is pressed, // or the first line of the input finished, // or it gets EOF. while ((c = getchar()) != EOF && c != ' ') { // Increment the counter printf("char\t%lubyte ", sizeof(c)); printf("int\t%lubyte ", sizeof(i)); printf("short\t%lubyte ", sizeof(s)); printf("long\t%lubyte ", sizeof(1)); printf("long long\t%lubyte ", sizeof(11)); printf("float\t%lubyte ", sizeof(f)); printf("double\t%lubyte ", sizeof(d) printf("signed int\t%lubyte ", sizeof(si)); printf("unsigned int\t%lubyte ", sizeof(usi)); } // Print the number of the input characters return 0; return 0; 2 Count Characters Complete the hw1.c so that it will count the input characters and print out the number. The while loop condition is smilar to getchar_2.c, but it has an extra condition c != ' ', which means pressing Enter also stops the while loop. Once you complete the program, running command gcc hw1.c -o hw1 && ./hw1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!