printf("%s%d%c", s, a, c);
The string would be printed on the stdout; but how the implementation knows to define what
size of the char array to hold result?
Or the alternative way is: use the fixed size buffer, handle each variable argument behind the format string, if the interpreted string size exceed the buffer size, then output it to output stream. Is this true?
By the way, I think, the string type in C++, its implementation uses the heap memory, dynamic memory allocator, just as new, or delete, is this correct?
That’s correct. Which is a stream, no char[] is required. Only sprintf() would require a guess at a string buffer size.