www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/02/16:55:20

From: uhfgood AT aol DOT com (Uhfgood)
Newsgroups: comp.os.msdos.djgpp
Subject: Using the atoi function...
Lines: 19
NNTP-Posting-Host: ladder01.news.aol.com
X-Admin: news AT aol DOT com
Date: 2 Oct 1998 20:52:56 GMT
Organization: AOL http://www.aol.com
Message-ID: <19981002165256.11675.00001371@ng108.aol.com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I have something wierd...  Basically I made a small program that asked for the
age of Methusela (a character in the bible who lived 969 years)...  Anyhow it
was supposed to demonstrate the atoi function, well it works but there's
something peculiur... basically I read in the number into the character array
years (as such char years[8]) and then i use age (which is in integer) like
this ( age = atoi(years) )
now i checked my code nothing wrong with the statements...  and yes i did use
an  i not an l ... anyhow, when i run the program, it works fine, no problems
but that's the point... I can type in up to 10 digits without displaying some
other number... it's as if i had used a long and stead of an int, but it is for
sure an int...  Can someone explain why i'm able to type up to 10 digits with
no problems.... I thought an integer could only hold up 32767... please reply
soon, and i'm sorry if this is an annoying newbie question.                    
                                            -KWII-

*Keith Weatherby II*
*Uhfgood AT aol DOT com*
*Vice AT gconn DOT com*

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019