SL>int main(void)
SL> {
SL> char *sTemp;
SL> int iTemp;
AM> sTemp = (char*)malloc(sizeof(char)*256); <- enough space for 256 digits!
Space for 255 plus the nul. However...
Rather a bit of overkill since 16-bit ints can only have 5 bytes (plus the
nul) = 6. ;-)
SL> printf("Enter a number: ");
SL> scanf("%s", sTemp);
AM> NULL pointer!!!!! Causes lot's of run-time errors. You must allocate the
AM> memory before using it.
Nope NOT NULL pointer!!!! _RANDOM_ pointer. :-)
---
---------------
* Origin: Tanktalus' Tower BBS (1:250/102)
|