TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: DARIN MCBRIDE
from: SIMON LAW
date: 1998-03-28 16:36:00
subject: atoi(const char .s)

   "What's this button labeled 'atoi(const char *s)' do?" asked Darin 
cBride.
   "No!  Don't push it!!!" screamed Simon Law seconds too late. 
Hi Darin McBride,
 SL> only have 5 bytes (plus
 DM> the nul) = 6.  ;-) 
 SL>    printf("Enter a number: ");
 SL>    scanf("%s", sTemp);
 AM> NULL pointer!!!!! Causes lot's of run-time errors. 
 AM> You must allocate the
 AM> memory before using it.
 DM> Nope NOT NULL pointer!!!!  _RANDOM_ pointer.  :-)
 SL>         Wait a second?  Is this PSEUDOrandom or is it TRULY random?
 SL> There could be interesting implications...
 DM> Literally, it is merely whatever was in that memory location before it
 DM> "became" a char*. 
        [snip]
 DM> Next time you call foo, if nothing else was called, it will _likely_
 DM> have the same value as it left with.  However, there is nothing to
 DM> guarantee this - the compiler is free to (but rarely does, except for
 DM> a few debugging libraries) put more garbage into the stack area that
 DM> isn't "owned" by your program. 
        Ugh.  That's not QUITE good.  *grin*
        Well, it isn't truly random then, so we'll have to shrug it
off.
Scry you later!
         Fendolin...
... Only Windows makes the possible improbable
---
---------------
* Origin: Tanktalus' Tower BBS (1:250/102)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.