Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How printf function work in C?

user-image
Question added by Gaurav Kumar
Date Posted: 2014/09/24
Abdul Khader Shaik
by Abdul Khader Shaik , Cyber Crime Lawyer , Grofers

Printf is a variable length argument (as it take multiple arguments).User supply a string and input argumnets. Printf creates an internal buffer for constructing output string. Now printf iterates through each characters of user string and copies the character to the output string. Printf only stops at "%". "%" means there is an argument to convert. Arguments are in the form of char, int, long, float, double or string. It converts it to string and appends to output buffer. If the argument is string then it does a string copy. Finally printf may reach at the end of user sting and it copies the entire buffer to the stdout file.

 

Source:source:

Shafat Ahmad
by Shafat Ahmad , Trainer , Multichannel Educational Institute

the function printf() returns the number of characters printed on the console!

why there are some space between heap and stack section of memory?

Amirtha Lakshmi
by Amirtha Lakshmi , Teacher , Sivakasi Institute chartered accountants of india

It is used to display whatever the text within double quotes

More Questions Like This