Answer the question
In order to leave comments, you need to log in
Why doesn't outputting the value of a variable work in a for loop?
B. Kernighan and D. Ritchie "The C Programming Language, 3rd Edition, Revised", CLion 2019.3.3, C99 version.
#include <stdio.h>
//подсчет количества вводимых символов
int main() {
double nc;
for (nc = 0; getchar() != EOF; ++nc)
;
printf("%.0f,", nc);
}
Answer the question
In order to leave comments, you need to log in
Everything works correctly, you just need to add an end-of-file character to the end of the input text. On linux this is done by pressing Ctrl-D, on windows - Ctrl-Z
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question