Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   printf function changes int to char when using format specifier? (http://www.velocityreviews.com/forums/t552018-printf-function-changes-int-to-char-when-using-format-specifier.html)

vlsidesign 11-14-2007 09:38 PM

printf function changes int to char when using format specifier?
 
Example
printf("I have %d cars. \n", 10);

Is it more correct to say that the printf function doesn't insert the
integer, rather into changes the integer into chars and then inserts
it?


user923005 11-14-2007 09:45 PM

Re: printf function changes int to char when using format specifier?
 
On Nov 14, 1:38 pm, vlsidesign <ford...@gmail.com> wrote:
> Example
> printf("I have %d cars. \n", 10);
>
> Is it more correct to say that the printf function doesn't insert the
> integer, rather into changes the integer into chars and then inserts
> it?


Neither resembles something that is correct.

man printf()
http://linux.die.net/man/3/printf

Or perhaps:
http://www.dinkumware.com/manuals/de...nt%20Functions


Keith Thompson 11-14-2007 09:50 PM

Re: printf function changes int to char when using format specifier?
 
vlsidesign wrote:
> Example
> printf("I have %d cars. \n", 10);
>
> Is it more correct to say that the printf function doesn't insert the
> integer, rather into changes the integer into chars and then inserts
> it?


printf inserts (into the stdout output stream) a textual representation of the
int value 10.

It doesn't change the integer into anything; 10 is still an integer. Rather, it
computes a sequence of characters {'1', '0'} from the integer.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Looking for software development work in the San Diego area.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


All times are GMT. The time now is 11:50 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.