Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > printf() and sc...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 44 Topic 24817 of 27695
Post > Topic >>

printf() and scanf() questions

by Ioannis Vranos <ivranos@[EMAIL PROTECTED] > Mar 5, 2008 at 10:10 PM

The questions are about C95.



printf() questions:

1. printf() provides "%f" format specifier for double. Usually 
implemented as a variadic function how can it discern if the argument is 
float or double? Shouldn't we cast to double when passing a float value? 
If an implicit conversion takes place, at what stage does it take place? 
Consider as an example:

printf("%f\n", 123.45F);


2. The same question also applies when printing a signed char value with 
"%d" format specifier.



scanf() questions:

1. scanf() provides the "%f" specifier for float. How can it discern 
when we pass a double?


Example:

double x;

scanf("%f", &x);

If an implicit conversion to double takes place, at what stage does it 
take place? Also if such conversion takes place how it works when using 
a float variable?

Example:

float b;

scanf("%f", &b);
 




 44 Posts in Topic:
printf() and scanf() questions
Ioannis Vranos <ivrano  2008-03-05 22:10:26 
Re: printf() and scanf() questions
roberson@[EMAIL PROTECTED  2008-03-05 20:20:35 
Re: printf() and scanf() questions
Andrey Tarasevich <and  2008-03-05 13:33:01 
Re: printf() and scanf() questions
Micah Cowan <micah@[EM  2008-03-05 21:35:06 
Re: printf() and scanf() questions
Ioannis Vranos <ivrano  2008-03-06 00:25:56 
Re: printf() and scanf() questions
Micah Cowan <micah@[EM  2008-03-05 22:34:25 
Re: printf() and scanf() questions
Ioannis Vranos <ivrano  2008-03-06 00:22:34 
Re: printf() and scanf() questions
Ioannis Vranos <ivrano  2008-03-06 00:22:59 
Re: printf() and scanf() questions
Micah Cowan <micah@[EM  2008-03-05 22:40:08 
Re: printf() and scanf() questions
Martin Ambuhl <mambuhl  2008-03-05 19:22:04 
Re: printf() and scanf() questions
Mark McIntyre <markmci  2008-03-06 00:38:44 
Re: printf() and scanf() questions
Ioannis Vranos <ivrano  2008-03-06 02:49:38 
Re: printf() and scanf() questions
Ioannis Vranos <ivrano  2008-03-06 02:50:10 
Re: printf() and scanf() questions
Martin Ambuhl <mambuhl  2008-03-05 19:58:15 
Re: printf() and scanf() questions
Mark McIntyre <markmci  2008-03-06 21:44:02 
Re: printf() and scanf() questions
Martin Ambuhl <mambuhl  2008-03-06 17:41:58 
Re: printf() and scanf() questions
gazelle@[EMAIL PROTECTED]  2008-03-06 22:45:19 
Re: printf() and scanf() questions
Martin Ambuhl <mambuhl  2008-03-05 19:57:00 
Re: printf() and scanf() questions
Mark McIntyre <markmci  2008-03-06 21:45:54 
Re: printf() and scanf() questions
Antoninus Twink <nospa  2008-03-06 23:22:43 
Re: printf() and scanf() questions
gazelle@[EMAIL PROTECTED]  2008-03-06 22:44:33 
Re: printf() and scanf() questions
Martin Ambuhl <mambuhl  2008-03-06 17:44:18 
Re: printf() and scanf() questions
gazelle@[EMAIL PROTECTED]  2008-03-06 22:46:27 
Re: printf() and scanf() questions
Antoninus Twink <nospa  2008-03-07 00:09:19 
Re: printf() and scanf() questions
gazelle@[EMAIL PROTECTED]  2008-03-06 23:59:48 
Re: printf() and scanf() questions
jacob navia <jacob@[EM  2008-03-07 00:59:22 
Re: printf() and scanf() questions
Martin Ambuhl <mambuhl  2008-03-06 19:07:40 
Re: printf() and scanf() questions
gazelle@[EMAIL PROTECTED]  2008-03-07 01:45:00 
Re: printf() and scanf() questions
Mark McIntyre <markmci  2008-03-07 23:37:08 
Re: printf() and scanf() questions
Antoninus Twink <nospa  2008-03-08 00:42:29 
Re: printf() and scanf() questions
gazelle@[EMAIL PROTECTED]  2008-03-08 00:08:05 
Re: printf() and scanf() questions
Mark McIntyre <markmci  2008-03-06 21:48:54 
Re: printf() and scanf() questions
Antoninus Twink <nospa  2008-03-06 23:23:29 
Re: printf() and scanf() questions
gazelle@[EMAIL PROTECTED]  2008-03-06 22:42:17 
Re: printf() and scanf() questions
Martin Ambuhl <mambuhl  2008-03-05 15:50:02 
Re: printf() and scanf() questions
richard@[EMAIL PROTECTED]  2008-03-05 21:17:57 
Re: printf() and scanf() questions
Andrey Tarasevich <and  2008-03-05 13:21:18 
Re: printf() and scanf() questions
Richard <devr_@[EMAIL   2008-03-06 02:06:39 
Re: printf() and scanf() questions
CBFalconer <cbfalconer  2008-03-05 20:21:17 
Re: printf() and scanf() questions
Richard <devr_@[EMAIL   2008-03-06 23:55:12 
Re: printf() and scanf() questions
Richard <devr_@[EMAIL   2008-03-06 23:56:49 
Re: printf() and scanf() questions
gazelle@[EMAIL PROTECTED]  2008-03-07 00:03:38 
Re: printf() and scanf() questions
Richard <devr_@[EMAIL   2008-03-07 03:40:10 
Re: printf() and scanf() questions
Richard <devr_@[EMAIL   2008-03-08 19:45:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 11:40:28 CDT 2008.