![]() |
|
#1
|
|||
|
|||
Compiler errorsI've been doing some coding in C lately, and I'm having trouble figuring out why it won't compile. I've took care of most of the compiler errors, but for the rest I'm not even sure what they mean. I'm compiling using GCC on a Sun Solaris.
My code: CPP / C++ / C Code:
My compiler errors: Quote:
Thanks for any help. /vital_101 |
|
#2
|
||||
|
||||
Re: Compiler errorsSee the changed code...it can be bettered in many ways...just made it work for the moment
CPP / C++ / C Code:
__________________
Gravitation is not responsible for people falling in love. -Albert Einstein Last edited by LuciWiz : 13-Jan-2006 at 01:08.
Reason: Please insert your C code between [c] & [/c] tags
|
|
#3
|
|||
|
|||
Re: Compiler errorsQuote:
The correct way would be: CPP / C++ / C Code:
Think over it. I'm too sleepy right now, to think anymore. Logging off.... Saving your settings...... My Mind is shutting down...... [Blup] Netnut. |
|
#4
|
||||
|
||||
Re: Compiler errorsBecause when calling a function:
CPP / C++ / C Code:
CPP / C++ / C Code:
n - pass the address of the variable My personal preference for the function is: CPP / C++ / C Code:
Also, I question whether your n has a useful value. It returns 1 if there are more than count values entered, and 0 when there are fewer. __________________
Age is unimportant -- except in cheese |
|
#5
|
|||
|
|||
Re: Compiler errorsQuote:
An excellent point of style for functions that return only one thing. Quote:
n is equal to the last value returned by scanf() before control left the loop: It could be 0; it could be 1; it could be EOF. Anyhow, like WaltP, I don't see the usefulness of having the function return the value of n. Maybe it should return count, since there is no other way for the calling program to know how many items were successfully scanned. (And, of course, that means that count should be initialized to at the beginning of the function.) Regards, Dave |
Recent GIDBlog
Welcome to Baghdad by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Today's C/C++ Programming Tip :-) | Paramesh | C Programming Language | 6 | 10-Feb-2007 23:46 |
| Help wit my source code compiler errors | Krandygrl00 | C++ Forum | 1 | 06-Jun-2005 08:14 |
| Help with compiler errors | Krandygrl00 | C++ Forum | 3 | 01-Jun-2005 07:45 |
| Newbie : need help with Dev-C++ compiler | batrsau | C++ Forum | 2 | 20-Mar-2005 21:05 |
| compiler errors | Newworld | C Programming Language | 1 | 28-Oct-2004 07:07 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The