terminal - C - fprintf and printf inside loops don t print to screen -
i discovered function fprintf can used print screen.
i have minimal below, doesn t output screen. why?
#include <stdio.h> int main(void) { int i,j,k; for(i=0;i<4;i++) { for(j=0;j<0;j++) { for(k=0;k<3;k++) { printf("test\n"); fprintf(stderr, "test\n"); } } } return 0; }
i running ubuntu 14.04 , compiling code follows: gcc main.c -o main
why should print anything? 1 of loops has impossible condition:
for(j=0;j<0;j++) ^---
since j
starts @ 0
, can never less 0
, loop exits without ever executing body.
Comments
Post a Comment