fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(int argc, char *argv[]) {
  4. int number;
  5. int places = 0;
  6.  
  7. scanf("%d", &number);
  8.  
  9. if ( number == 0 ) {
  10. number = 1;
  11. }
  12. for ( int counter = 1; counter <= number; counter *= 10 ) {
  13. places += 1;
  14. }
  15. printf("%d\n", places);
  16.  
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:12:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for ( int counter = 1; counter <= number; counter *= 10 ) {
     ^
prog.c:12:5: note: use option -std=c99 or -std=gnu99 to compile your code
stdout
Standard output is empty