Arduino Forum

Using Arduino => Programming Questions => Topic started by: HazardsMind on Jan 25, 2013, 03:13 pm

Title: Crash coarse on pointers and references
Post by: HazardsMind on Jan 25, 2013, 03:13 pm
Im trying to understand pointers and De/references, can anyone give me a good detailed explanation on them? Ive tried wiki and some other sites, but I still can't get a good grasp of them. Can anyone help me?
Title: Re: Crash course on pointers and references
Post by: AWOL on Jan 25, 2013, 03:26 pm
A pointer is just an address.

If I write "2115 West Street" on a scrap of paper, I haven't given you a house, I've given you a reference to a house.
Title: Re: Crash coarse on pointers and references
Post by: wildbill on Jan 25, 2013, 03:48 pm
Here's a link with a number of different explanations: http://programmers.stackexchange.com/questions/17898/whats-a-nice-explanation-for-pointers (http://programmers.stackexchange.com/questions/17898/whats-a-nice-explanation-for-pointers)
Title: Re: Crash coarse on pointers and references
Post by: michinyon on Jan 25, 2013, 04:07 pm
There are thousands of books on  how C style languages work,  including some online for free.

I suggest you acquire one and read it.   Do you really expect us to sit here and manually type
out a few chapters of a programming text book for you ?
Title: Re: Crash coarse on pointers and references
Post by: Jimmy60 on Jan 25, 2013, 04:11 pm
http://www.cplusplus.com/doc/tutorial/ (http://www.cplusplus.com/doc/tutorial/)

One of the better tutorials you'll find. There's a good section on pointers. Great site for language reference as well.
Title: Re: Crash coarse on pointers and references
Post by: cmiyc on Jan 25, 2013, 04:47 pm
I'm a fan of: http://pweb.netcom.com/~tjensen/ptr/cpoint.htm. 

I keep a copy of his PDF to review whenever I start using pointers:
http://home.earthlink.net/~momotuk/pointers.pdf
Title: Re: Crash coarse on pointers and references
Post by: HazardsMind on Jan 29, 2013, 02:29 pm
@Jimmy60
Sorry im just now getting back to my own post. Thanks Jimmy, that site is awesome.
Title: Re: Crash coarse on pointers and references
Post by: liuzengqiang on Jan 29, 2013, 02:37 pm
Get a book! You don't know pointers then you don't know much of C. Time to do C 101.
Schildt
http://www.herbschildt.com/
Title: Re: Crash coarse on pointers and references
Post by: HazardsMind on Jan 29, 2013, 02:53 pm
Quote
You don't know pointers then you don't know much of C.
I didn't know anything about programming before college, to be honest, I wanted nothing to do with programming. Originally I thought I was just going for electrical engineering, but they told me I had to learn programming too. So whatever the professor taught is what I learned, and we did not cover pointers.
Title: Re: Crash coarse on pointers and references
Post by: liuzengqiang on Jan 29, 2013, 05:28 pm

Quote
You don't know pointers then you don't know much of C.
I didn't know anything about programming before college, to be honest, I wanted nothing to do with programming. Originally I thought I was just going for electrical engineering, but they told me I had to learn programming too. So whatever the professor taught is what I learned, and we did not cover pointers.


Every science and engineering major should learn a course in C. It's just that necessary. A considerable portion of ECE is computer engineering, developing firmwares with hardware and software knowledge. Most senior ECE projects/proposals I've seen so far have some programming elements. You probably took an intro to programming course but should have been better off with intro to C, which by goud, covers pointers. I recommend C from ground up (don't know if it's still in print or replaced by C++ from ground up).
Title: Re: Crash coarse on pointers and references
Post by: HazardsMind on Jan 29, 2013, 05:42 pm
@liudr

In my 4 years of college, I had to learn Assembly, Basic, C, C++, C#, Java, HTML5, and XML, all without any prior knowledge going into college. Except basic, I learned that from making programs on my graphing calculator. We learned only what we needed to know (absolutely necessary), to get us by. So within that time, I think I did ok.

Keep in mind that I didn't have ANY programming class my entire first year. Yet I walked away with a Bachelors degree in Electrical and Computer Engineering, and I plan to go back for my masters.
Title: Re: Crash coarse on pointers and references
Post by: liuzengqiang on Jan 29, 2013, 06:04 pm
HazardsMind,

But pointers knowledge is THE MOST IMPORTANT of C. I'm appalled at this strange combo of vast programming knowledge you possess and the absence of pointers. Of course, you only learned what you needed for your degree, which may not involve using pointers. I learned C and other languages on my own (reading books in the 80s and 90s) too, before college but my college course had C so I did go through pointers in a formal class. If you want to learn and master it, you need to get the intro to C or something and patch up this hole. Assembly was good. At least you don't have to teach yourself about memory structure like others do.

I'm not trying to make you look bad or novice. I know nothing about your background till now. All I was doing was pointing out a good intro book. To anyone that knows nothing about pointers or else, I find reading a book is a thousand times better than reading off bits and bytes off the net. You don't get that systematic teaching and exercises as a book would give you and Schildt is my favorite author. What's rush to whiplash on a good recommendation? I'm not interested in arguing with you either on your thread or with PMs. You don't like it, just ignore then.