Skip to content

Tag Archives: cpp-input-output

It is known that, printf() function is an inbuilt library function in C programming language in the header file stdio.h. It is used to print… Read More
Consider the following statement in C and predict its output. printf("%d %d %d", i, ++i, i++); This statement invokes undefined behavior by referencing both ‘i’… Read More
What is a buffer?  A temporary storage area is called a buffer. All standard input and output devices contain an input and output buffer. In… Read More
Regular competitive programmers face common challenge when input is large and the task of reading such an input from stdin might prove to be a… Read More
getchar_unlocked() is similar to getchar() with the exception that it is not thread-safe. This function can be securely used in a multi-threaded program if and… Read More
endl and \n both seem to do the same thing but there is a subtle difference between them.  cout << endl inserts a new line… Read More
In C++, if we need to read a few sentences from a stream, the generally preferred way is to use the getline() function as it can… Read More
fprintf is used to print content in file instead of stdout console. int fprintf(FILE *fptr, const char *str, ...); Example:  C // C Program for… Read More
Syntax:  int sprintf(char *str, const char *string,...); Return:  If successful, it returns the total number of characters written excluding null-character appended in the string, in… Read More
What values do the printf() and scanf() functions return ?   printf() : It returns total number of Characters Printed, Or negative value if an output… Read More

Start Your Coding Journey Now!