Please tell me if this is possible.
Code:return (numberOfKegs && numberOfCases);
Please tell me if this is possible.
Code:return (numberOfKegs && numberOfCases);
Either
- create a structure with 2 members, and return that struct.
- pass pointers to where you want numberOfKegs and numberOfCases stored.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Is it possible?
Yes.
Does it do what you want?
No.
This will return 0 or 1, depending on the logical operation inside the parenthesis. Remember, that everything except zero is true!
What you need is to pass these two variables as arguments by reference in your function. (other solutions too, but this is what you should do in my opinion).
//Since parenthesis is a Greek word, I am little confused here. How do you write parenthesis in plural? Or this is plural? :P
Code - functions and small libraries I use
It’s 2014 and I still use printf() for debugging.
"Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson
In this context, "parenthesis" is an English word of Greek origin. Its plural is "parentheses".Originally Posted by std10093
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Thank you Laserlight
Well the Greek word is παρένθεση, that's why I said Greek word, but you are right
Code - functions and small libraries I use
It’s 2014 and I still use printf() for debugging.
"Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson