Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

buffer size of printf() in VC2010

$
0
0

What's the actual size of the buffer of printf() function in VC2010?

As we know, printf() will print the string from the buffer in 3 situations, the buffer is full / getting user input / meet '/n' character.

However, I got a situation which didn't satisfy those 3 situations unless the buffer of printf() is less than 1 char....

In the following code, the string "H" only occupy the buffer 1 char unit, but still be printed before the for-looping.

*I'm using ANSI C in programming

#include <stdio.h>
#include <limits.h>

int main(void)
{
	int n;

	printf ("H");

	for (n = 1; n < INT_MAX; n++)
	{

	}

	printf ("i");
	getchar();
	return 0;
}




Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>