|
Hi,
I'm fairly new to objective C and I'm just learning how to use functions. In the below function I understand what the first line does but then the statements below have me a bit confused can anyone explain it to me? Its the "theBudget->budget" bit I dont understand.
void spendDollars (budget* theBudget, double dollars) {
theBudget->budget -= dollars;
Thanks for your help in advance 
|
|
|
|
|
This is standard C notation, and a fundamental construct of the language. If you don't understand it, then you really need to go back to basics and get yourself an introductory book. The first parameter (theBudget ) in the function declaration is a pointer to a budget object (Class or Structure). In the first line of the function the program is subtracting the value of the dollars item from the budget member of the object. A rather poor use of names calling a member of the object by the same name as the object type. In fact I'm not sure that that would not produce a compiler error or warning.
Veni, vidi, abiit domum
|
|
|
|
|
Hi Richard,
Thanks for the explanation. I am a beginner and this is an example they are using in an introductory book to explain functions. Going off what you have said this is a pretty poor example which is probably why I'm getting a bit confused.Thanks for the help 
|
|
|
|
|
|
ericgahn wrote: I cannot find a proper Mac forum so will ask this q here. Why? Your question has nothing to do with Objective-C. And a quick Google search will find you plenty of sites for Mac users.
Veni, vidi, abiit domum
|
|
|
|
|
Marc I know it is not about Objective-C and I did Google but all that comes up is Retina related.
|
|
|
|
|
|
|
|
Veni, vidi, abiit domum
|
|
|
|
|
I am starting out in Apple dev environments. I have downloaded some pdf's and located some tutorials on the Internet however do not know where to start. There are some on iOS programming, some Objective-C, some Soryboard etc...
Any pointers on how to proceed and sequence will be appreciated. My main interest initially is iPhone.
Thanks
Eric
modified 8-Jan-14 18:05pm.
|
|
|
|
|
Start Here[^]
If you want to program for iPhone then that's the best way to start - you'll learn Objective-C in order to do so and look at storyboards too
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
|
I want some basic tutorials for objective C. thanks
|
|
|
|
|
|
|
http://andrewd.ces.clemson.edu/courses/cpsc102/notes/ObjC.pdf
|
|
|
|
|
http://readwrite.com/2011/05/14/4-free-e-books-on-objective-c#awesm=~ovhdJ9RdeJ7Vk3
http://www.cs.colorado.edu/~kena/classes/5448/f11/lectures/12-introtoobjectivec.pdf
http://www.cocoalab.com/BecomeAnXcoder.pdf
http://pierre.chachatelier.fr/programmation/fichiers/cpp-objc-en.pdf
http://it-ebooks.info/go.php?id=1201-1391871296-28241bd5ccd775d0306ee7dd48a737d8
https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/ProgrammingWithObjectiveC.pdf
|
|
|
|
|
don't use recursion also...
|
|
|
|
|
This is not a valid question. Go back to your reference books or lecture notes and try to work out a strategy.
Veni, vidi, abiit domum
|
|
|
|
|
Richard MacCutchan wrote: This is not a valid question.
Just curious about that. Maybe with qualification it would be clearer. Like it isn't 'valid' because it is a homework question and one should do ones own work? If so then 'valid' might not be the best word.
Or perhaps because it isn't possible to do what the OP asked in Objective-C?
|
|
|
|
|
Or perhaps it is just not a valid question.
Veni, vidi, abiit domum
|
|
|
|
|
Let me make my previous question more clear - how exactly is the original question not "valid"?
It looks valid to me. I am using the following definition (from google).
valid: (of an argument or point) having a sound basis in logic or fact: reasonable or cogent.
|
|
|
|
|
jschell wrote: It looks valid to me. Then by all means, feel free to answer it.
Veni, vidi, abiit domum
|
|
|
|
|
This is not valid question because two dimensional array means one Row and one column.If you want to print without second loop so you have to give column address.
Example:-
For(int i=0;i<3;i++)
{
arr[i][0]=10;
arr[i][1]=23;
arr[i][2]=33;
}
But this is wrong way for programming.
|
|
|
|