| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | scanf() gets() me confused |
SD>> Also, use int main() and return a 0 at the end of the SD>> program instead of using void main(). JS> I actually altered the programme to void main(void) because I JS> thought using int main(void) would be considered newbieish. :-) JS> I'll stick to my convictions in future. SD> :-) I use it because it allows me to control the return code. I don't SD> know why Paul recommends it. I had a fun argument with Paul E about this a little while ago, in one of the local echoes on his board. Paul gets quite rabid about it, starts spouting about Standards, but the best arguments came from Rod Speed: 1. Specifying a return value allows the operating system to see if a program terminated normally or abnormally - in Dos, this is typically done with batch files and errorlevels. Now, while you may see no need for this, your program might just end up on someone else's machine, and he might strike a funny problem that you didn't see or didn't think was important. If your program provides sensible return values, he can set up batch files to test your program, or to take corrective action if required. 2. It takes little effort to implement, so why not do it? Failing to specify a return value results in a fairly random return value, instead of no return value at all. I know, I've tested it. Cheers --- PPoint 1.86* Origin: Silicon Heaven (3:711/934.16) SEEN-BY: 711/809 934 @PATH: 711/934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
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™.