By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,778 Members | 2,015 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,778 IT Pros & Developers. It's quick & easy.

pls abt printf

P: 43
guys i'm really pleasing to you .. please anyone knows abt the printf stmt (internal working) please post your ideas..
waiting for your reply..

thanks in advance..
Oct 4 '06 #1
Share this Question
Share on Google+
4 Replies


Banfa
Expert Mod 5K+
P: 8,916
It is platform defined, that is each platform is free to do it anyway it wishes as long as it produces the correct result.

Why do you want to know this?
Oct 4 '06 #2

P: 43
It is platform defined, that is each platform is free to do it anyway it wishes as long as it produces the correct result.

Why do you want to know this?
i need to know how it finds place holders and variable, and how it converts the variable to place holders datatype, then how the excess args are ignored....
Oct 4 '06 #3

Banfa
Expert Mod 5K+
P: 8,916
Well most of the implementations I have seen/written use a char * to iterate down the string picking out the % characters and parsing the characters that follow.

This lets you pick out the data from the parameters using

va_start
va_arg
va_end

macros defined in stdarg.h but it helps that in the absence of a string prototype variables are passed by default types (i.e. char and short are passed as int)

Ignoring extra data is easy, just don't access it.
Oct 4 '06 #4

P: 43
Well most of the implementations I have seen/written use a char * to iterate down the string picking out the % characters and parsing the characters that follow.

This lets you pick out the data from the parameters using

va_start
va_arg
va_end

macros defined in stdarg.h but it helps that in the absence of a string prototype variables are passed by default types (i.e. char and short are passed as int)

Ignoring extra data is easy, just don't access it.
THANK YOU VERY MUCH.. I HAVEN'T EXPECTED SUCH REPLIES FROM FORUMS.. THIS IS MY FIRST FORUM.. REALLY HAPPY..
THANK YOU AGAIN..
Oct 4 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.