#Lost at C (Again!)
18-Mar-87 18:41:34
Sb: #59398-#Lost at C (Again!)
Fm: Richard Rae/SYSOP 76703,4253
To: John Draper 76703,4322
> Then why are you multiplying IntuitionBase by nothing?
I'm not. Several symbols in C are context dependent, in the same way "=" can
mean "is equal to" or assignment in BASIC. "*" is one of these.
When used between two quantities (variable or constant), * indicates
multiplication as you'd expect. When used in a unary fashion, before a single
term, it indicates indirection… a pointer, to be exact. Thus value is a
variable, whereas *value is a pointer to the value.
The other thing you need to know is that a data type in parens is a "type
cast", which explicitly says "change this type to that type". So, if you need
to assign a float to an integer, you can say integer=(int)float.
So, (struct IntuitionBase *)OpenLibrary(etc) says "cast the quantity which is
OpenLibrary(), that is, the result of the call, to type pointer-to-structure-of
-type-IntuitionBase".
I know, clear as mud, right? It does take some getting used to.
Rick