[Courses] C Programming For Absolute Beginners, Lesson 2: Fun With Printf, Scanf, Puts, and Variables

Carla Schroder carla at bratgrrl.com
Tue Feb 21 19:42:25 UTC 2012


On Wednesday, February 22, 2012 12:10:25 AM Sachin Divekar wrote:
> Hi,
> 
> I am really enjoying discussions on this course's mailing list.
> 
> Now towards the question.
> 
> I tried a very large input to addition program. Following was the result.
> 
> ==========================================
> sachin at sachin-ThinkPad-T420:~/projects/C$ ./addition
> Please enter any number up to three digits:
> 1111111111111111111111111
> Please enter another number up to three digits:
> 1111111111111111111111111111111111111111111111
> -1 + -1 = -2
> ===========================================
> 
> A quick reading on Wikipedia about C data type "int" says,
> 
> "basic signed integer type. At least 16 bits in size."
> 
> So, what exactly "16 bits in size" means? I know 1 bit is either state
> 1 or 0. But how this(bits) determines size of number?
> 
> Thanks.
> 
> --
> Regards,
> Sachin


This page should help you understand int and other C data types. It gives some 
good examples of printf conversions too:

C Data Types
http://cprogramminglanguage.net/c-data-types.aspx

best,
Carla
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Carla Schroder
ace Linux nerd
author of Linux Cookbook,
Linux Networking Cookbook,
Book of Audacity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the Courses mailing list