I've always wanted to learn C...
Jorge P
Posts: 385
The main confusion for me is are the colons " : ", " :: ", stars " * ", " ** ", and "->". For the most part I can follow c program structures but get lost with structs, when to use them, etc... In code, I have only seen "->" in cpp programs, or at least the ones I have obtained/compared.
Will there be a book for Propeller GCC, and C programming in general, eventually, that will show a newbie to c programming how it all works? Hopefully without the lengthy helloWorld chapter, I would like something more like the Jabberwok example in Java. I have read the beginning 1/3 of at least 3 different c programming books over the years and they always lose my attention the first couple of chapters. I would prefer something more like an *nix info-manual but in PDF or hardcopy. I would like to see explanations of things like if, else, case, while, etc.. kept to a minimum since they are similar in most languages including basic.
Is this just me, or do others feel the same about the modern programming books? Am I stuck with C# for life?
I will be watching this section of the forums for the first non alpha/beta release. I'd like to finally give c a whirl after I try to forget C#. I want to learn as if I didn't know any programming at all, to a certain extent.
Thanks to the developers for taking on the lengthy task of porting and testing.
Will there be a book for Propeller GCC, and C programming in general, eventually, that will show a newbie to c programming how it all works? Hopefully without the lengthy helloWorld chapter, I would like something more like the Jabberwok example in Java. I have read the beginning 1/3 of at least 3 different c programming books over the years and they always lose my attention the first couple of chapters. I would prefer something more like an *nix info-manual but in PDF or hardcopy. I would like to see explanations of things like if, else, case, while, etc.. kept to a minimum since they are similar in most languages including basic.
Is this just me, or do others feel the same about the modern programming books? Am I stuck with C# for life?
I will be watching this section of the forums for the first non alpha/beta release. I'd like to finally give c a whirl after I try to forget C#. I want to learn as if I didn't know any programming at all, to a certain extent.
Thanks to the developers for taking on the lengthy task of porting and testing.
Comments
Those colons won't bother you much in C proper, except for some special cases of shorthand which can safely be ignored for the time being. The thing about asterisks and arrows (* and ->) is all about learning to understand pointers, i.e. addresses. What the asterisk does is to refer to the value that the pointer (the address) is pointing to, and the arrow refers to an item of a struct (a record), just like a period ('.') does - the difference is that if an arrow is used then what you have is a pointer to the record, not the record itself. So, if you define a record (a struct) with members, then send the struct to a function the function can access the members by '.' if you pass the struct itself. If you passed the address to the struct (by prefixing it with '&') then the function must access its members by '->'.
-Tor
thanks for the explanation, the c books usually take several chapters to explain that.
@Leon or Tor
Is the book you are referring to this one by "Prentice Hall, Inc." http://cm.bell-labs.com/cm/cs/cbook/ ? I had purchased other books on c programming, "Learn C and C++" and "C for Dummies", but never this one.
I can't say for sure because Parallax is just now beginning to explore the possibilities of C with the Propeller, but I'd be willing to bet that the Education department at Parallax recognizes the need for a C/C++ book. However, they would need the tool to be completed before they could really start writing. For now, other C/C++ books would the way to go to teach yourself.
By the way, if memory serves, the "->" in C dereferences the pointer to a structure and access the named variable/object within the structure. Something like that...
Found this:
From http://stackoverflow.com/questions/2575048/arrow-operator-usage-in-c