Reply by dk March 23, 20102010-03-23
On Mar 15, 9:51=A0pm, linnix <m...@linnix.info-for.us> wrote:
> On Mar 14, 10:01=A0pm, D Yuniskis <not.going.to...@seen.com> wrote: > > > Royston Vasey wrote: > > > I'm pushing along trying to learn some C using MCC18. Can someone ple=
ase
> > > tell me what the "&" before the variable "variable" does or means in =
the
> > > code below? I'm finding it hard to find basic info like this in the > > > documentation I've found. > > > > Is it AND? AND with what? > > > > =A0 =A0 ee_read_byte(0x00, &cal_var); //initialise calibration variab=
le from
> > > eeprom > > > > why the "&" -----------^ > > > read as: "address of" ... > > I always wonder why they did not use @. =A0It would have been much > clearer. =A0After all, it was designed by a committee of two only.
May be thats why "committee of two" have also provided macros. If you wanted to use @ for &, what do you want to use for @ ?
Reply by Nial Stewart March 16, 20102010-03-16
>> What you actually need is introductory documentation of the C programming language, a.k.a. a C >> textbook. The 2nd edition of the one by Kernighan & Ritchie, who invented the language, is still >> among the best. > > Thanks for the reply. I dont doubt you are correct with your comments re my approach! :)
As a hardware engineer who 'did some C at university' I found 'Practical C Programming' (O'Reilly) very good. Nial.
Reply by Royston Vasey March 16, 20102010-03-16
"D Yuniskis" <not.going.to.be@seen.com> wrote in message 
news:hnkhol$rsc$1@speranza.aioe.org...
> Royston Vasey wrote: >> I'm pushing along trying to learn some C using MCC18. Can someone please >> tell me what the "&" before the variable "variable" does or means in the >> code below? I'm finding it hard to find basic info like this in the >> documentation I've found. >> >> Is it AND? AND with what? >> >> ee_read_byte(0x00, &cal_var); //initialise calibration variable from >> eeprom >> >> why the "&" -----------^ > > read as: "address of" ... > >> unsigned char ee_read_byte(unsigned char address, unsigned char *_data){ > > ... because this expects a pointer (i.e., an address) ------------^^^^ > >> EEADR = address; >> EECON1bits.CFGS = 0; >> EECON1bits.EEPGD = 0; >> EECON1bits.RD = 1; >> *_data = EEDATA; >> }
thanks for that.
Reply by Royston Vasey March 15, 20102010-03-15
"Hans-Bernhard Br&#4294967295;ker" <HBBroeker@t-online.de> wrote in message 
news:hnl8hm$i14$00$1@news.t-online.com...
> Royston Vasey wrote: > >> I'm pushing along trying to learn some C using MCC18. Can someone please >> tell me what the "&" before the variable "variable" does or means in the >> code below? I'm finding it hard to find basic info like this in the >> documentation I've found. > > That's because you've either been looking for the wrong kind of > documentation, or you've tackled this whole "learning a programming > language" task entirely the wrong way round. > > What you actually need is introductory documentation of the C programming > language, a.k.a. a C textbook. The 2nd edition of the one by Kernighan & > Ritchie, who invented the language, is still among the best. > > And the right order of things is not to jump in and try to understand > existing code by guessing what each letter in it means, but to actually > _learn_ the language first, then apply that knowledge to existing code.
Thanks for the reply. I dont doubt you are correct with your comments re my approach! :)
Reply by linnix March 15, 20102010-03-15
On Mar 14, 10:01=A0pm, D Yuniskis <not.going.to...@seen.com> wrote:
> Royston Vasey wrote: > > I'm pushing along trying to learn some C using MCC18. Can someone pleas=
e
> > tell me what the "&" before the variable "variable" does or means in th=
e
> > code below? I'm finding it hard to find basic info like this in the > > documentation I've found. > > > Is it AND? AND with what? > > > =A0 =A0 ee_read_byte(0x00, &cal_var); //initialise calibration variable=
from
> > eeprom > > > why the "&" -----------^ > > read as: "address of" ... >
I always wonder why they did not use @. It would have been much clearer. After all, it was designed by a committee of two only.
Reply by D Yuniskis March 15, 20102010-03-15
Hi Vladimir,

Vladimir Vassilevsky wrote:
> > Royston Vasey wrote: >> I'm pushing along trying to learn some C using MCC18. Can someone >> please tell me what the "&" before the variable "variable" does or >> means in the code below? > > This symbol means "the one with a tail should go down from the tree".
ROTFL!
Reply by Vladimir Vassilevsky March 15, 20102010-03-15

Royston Vasey wrote:
> I'm pushing along trying to learn some C using MCC18. Can someone please > tell me what the "&" before the variable "variable" does or means in the > code below?
This symbol means "the one with a tail should go down from the tree". VLV
Reply by March 15, 20102010-03-15
Royston Vasey wrote:

> I'm pushing along trying to learn some C using MCC18. Can someone please > tell me what the "&" before the variable "variable" does or means in the > code below? I'm finding it hard to find basic info like this in the > documentation I've found.
That's because you've either been looking for the wrong kind of documentation, or you've tackled this whole "learning a programming language" task entirely the wrong way round. What you actually need is introductory documentation of the C programming language, a.k.a. a C textbook. The 2nd edition of the one by Kernighan & Ritchie, who invented the language, is still among the best. And the right order of things is not to jump in and try to understand existing code by guessing what each letter in it means, but to actually _learn_ the language first, then apply that knowledge to existing code.
Reply by FreeRTOS info March 15, 20102010-03-15
On 15/03/2010 05:26, Royston Vasey wrote:
> I'm pushing along trying to learn some C using MCC18. Can someone pleas=
e=20
> tell me what the "&" before the variable "variable" does or means in th=
e=20
> code below? I'm finding it hard to find basic info like this in the=20 > documentation I've found. >=20 > Is it AND? AND with what? >=20 > thanks
<snip> I don't think you can learn C very efficiently by posting questions to ask what the syntax does. The normal and more efficient method is to read a book. If that is too old fashioned, then try Google: http://home.netcom.com/~tjensen/ptr/pointers.htm --=20 Regards, Richard. + http://www.FreeRTOS.org Designed for Microcontrollers. More than 7000 downloads per month. + http://www.SafeRTOS.com Certified by T=DCV as meeting the requirements for safety related systems= =2E
Reply by D Yuniskis March 15, 20102010-03-15
Royston Vasey wrote:
> I'm pushing along trying to learn some C using MCC18. Can someone please > tell me what the "&" before the variable "variable" does or means in the > code below? I'm finding it hard to find basic info like this in the > documentation I've found. > > Is it AND? AND with what? > > ee_read_byte(0x00, &cal_var); //initialise calibration variable from > eeprom > > why the "&" -----------^
read as: "address of" ...
> unsigned char ee_read_byte(unsigned char address, unsigned char *_data){
... because this expects a pointer (i.e., an address) ------------^^^^
> EEADR = address; > EECON1bits.CFGS = 0; > EECON1bits.EEPGD = 0; > EECON1bits.RD = 1; > *_data = EEDATA; > } > >