Submitted Questions

  • cprintf vs printf

    cprintf is defined to send formatted output to the text window on the screen. And printf directs its output to the stdout. What is the difference between stdout and a text window then? Does the screen serve differently while using cprintf and printf? Please explain

  • Difference between printf and cprintf

    What is the difference between cprintf and printf? Please explain in detail.

    indinfer

    • Nov 16th, 2014

    I think the original question was not a typo. The original question was printf, not fprintf, compared to cprintf. And I think printf output goes to stdout (standard out) which by default goes to con (the console). cprintf output goes only to con.

    Howard Lee Harkness

    • Apr 4th, 2013

    Cprintf outputs to the console device.
    fprintf outputs to a stream specified by the 1st parameter.

  • pre and post increment operators

    why does ++i * ++i give 49 when i=5?

    Pujitha

    • Jun 27th, 2019

    I=5;
    ++i * ++i; (6*7)(if the i is the value 7)
    7*7;
    49

    Ankush Batra

    • Nov 1st, 2018

    The ans is 49 only
    bcoz i cant be 2 values(6, 7) at a time so, i should be 7 at last
    thats why 7*7 = 49.

  • enter key carriage return or linefeed?

    When we press enter to end the program and press Alt+F5 to see the output again, we see that the getche() function places the cursor at the beginning of the line. So, does the enter key specify carriage return in this case. But while entering output, it works as a newline character... Please explain the difference in both the contexts.

    AnSi

    • Sep 8th, 2012

    Enter key is line feed.

  • getch function declaration

    Can you please explain the declaration of getch() function that is "int getch(void)"? I have the doubt that if its return type is int, why is the character typed from the keyboard is displayed as it is? It should be displayed in its ASCII value. Also, what does void as parameter in this function stand for???

    jbode

    • Aug 31st, 2012

    In C, all the character-oriented functions (getc, fgetc, getchar, etc.) return int instead of char, mainly to support an out-of-band value for EOF (an integer expression with a negative value).

    The "void" in the parameter list indicates that the function takes no parameters.