Author Topic: Learning C By Graduated Tutorials  (Read 1602 times)

0 Members and 1 Guest are viewing this topic.

Offline rstoferTopic starter

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Learning C By Graduated Tutorials
« on: April 21, 2020, 02:54:20 pm »
When I learned to program in FORTRAN back around '70, I had real-world problems to solve and I needed/wanted to use a computer to solve them.  Over the years, I picked up Pascal and C in the same way.  First came the problem, then came learning to use a language to solve it.

These days, I don't have problems to solve so I haven't bothered much with C++, Java or Python although I will play with Python from time to time.  Most of my coding these days is in VHDL but that's a different story.

Given my experience of 'first have a problem' and 'then learn a language', I'm looking for recommendations for learning C by graduated  examples leading to some kind of project, the 'problem'.  Textbooks seem to pick a piece of the language, beat it to death and then move to another piece but NOWHERE does it ever say WHY you would want to know that piece and what it might be used for in the real world or how that piece fits with pieces previously discussed.  At least not that I have found...

Web sites, books, <whatever>, I am looking for suggestions of a learning approach that might make sense to somebody who really hates programming (several bad experiences, I suppose).  Actually Arduino or wiringPi for the Raspberry Pi make a certain amount of sense but neither use any more than the lowest level language constructs.  I suppose they are a start and you get immediate feedback when the LED blinks (or doesn't)., but there's more to code that blinking an LED in a while() loop.

I'm open to suggestions...

 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7696
  • Country: de
  • A qualified hobbyist ;)
Re: Learning C By Graduated Tutorials
« Reply #1 on: April 21, 2020, 03:21:18 pm »
Have you tried https://www.learn-c.org/ already? I've done their python intro a while ago and I like their approach.
 

Offline rstoferTopic starter

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Learning C By Graduated Tutorials
« Reply #2 on: April 21, 2020, 03:40:38 pm »
Have you tried https://www.learn-c.org/ already? I've done their python intro a while ago and I like their approach.

Not yet but I'll head over there after breakfast.  Thanks!

ETA:  How in the world do they expect a new student to complete the 'for' statements in the Multi-Dimensional Arrays section when the statement hasn't even been introduced and won't be for 3 more sections?

I do like the online compilation but I don't think I will be recommending this site.

« Last Edit: April 21, 2020, 04:12:25 pm by rstofer »
 

Offline rstoferTopic starter

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Learning C By Graduated Tutorials
« Reply #3 on: April 21, 2020, 10:17:24 pm »
Cprogramming.com looks encouraging.
 

Offline Aztlanpz

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Re: Learning C By Graduated Tutorials
« Reply #4 on: April 21, 2020, 10:49:51 pm »
The book Sams Teach Yourself C in 21 Days works for me.



Aztlan
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4196
  • Country: us
Re: Learning C By Graduated Tutorials
« Reply #5 on: April 22, 2020, 08:50:33 pm »
Quote
I don't have problems to solve so I haven't bothered much with C++, Java or Python although I will play with Python from time to time.  Most of my coding these days is in VHDL but that's a different story.
One of the things that ends up motivating me to use Python is the processing of "modern" data - HTML, JSON, XML...  There are presumably libraries to do these things in C++ or Java (or even C), but the Python is easier to find, and easier to "poke at" interactively.  Doesn't a lot of "chip description" stuff show up as XML (ARM .SVD files, for example...)
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6147
  • Country: ro
Re: Learning C By Graduated Tutorials
« Reply #6 on: April 22, 2020, 09:35:12 pm »
I found these classes interesting because the focus is on embedded C, here an ARM architecture, and it goes from a simple blinking LED to parallels between C and C++ (and how to implement objects oriented programming without C++), hardware debugging (so you learn the language, the tools, the hardware architecture, and a very rare thing in other classes, you actively see how C translates into ARM assembly, default memory initialization made by the C compiler, etc.), event driven programming, real time operating systems and so on.  All on a $10 ARM board (TM4C based) from Texas Instruments.

It is not hyped and entertaining, but very well presented, and if you practice on your own board it could be very interesting, especially as embedded C lessons for someone coming to programming with a hardware interest in mind.

See if it meets your expectations:

« Last Edit: April 23, 2020, 06:51:53 am by RoGeorge »
 

Offline rstoferTopic starter

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Learning C By Graduated Tutorials
« Reply #7 on: April 22, 2020, 11:06:56 pm »
Regrettably, the TI Stellaris Launchpad board, around which the videos were created, is obsolete.  I ordered the upgraded version of the Launchpad so I'll see how it works out in the near future.

Thanks for the tip!
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6147
  • Country: ro
Re: Learning C By Graduated Tutorials
« Reply #8 on: April 23, 2020, 07:08:08 am »
As long as the microcontroller has an ARM core, it should work.  When I bought it, the name was changed already from Stellaris to Tiva-C board.  Not sure how it is called now.

Beware the fact that Launchpad is a generic name, TI uses the same name for any of their low cost devboards, no matter what microcontroller is on the devboard.  For example, a MSP430 (or 430FR) Launchpad won't be good for those classes, because MSP430 architecture is different from ARM.

LATER EDIT:

Found it at TI for $12.99 (and on Amazon and Ebay at about twice the price) http://www.ti.com/tool/EK-TM4C123GXL. The 'Order Now' and 'Add to cart' buttons seems to be working, also is on stock at both Digi-Key and Mouser.
« Last Edit: April 23, 2020, 07:22:46 am by RoGeorge »
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23018
  • Country: gb
Re: Learning C By Graduated Tutorials
« Reply #9 on: April 23, 2020, 09:30:21 am »
I would learn C first then learn how to apply it to embedded systems.

The book I learned from is available here and is the one true C book. It's written by the guys who actually wrote C and is concise and drags you through the entire language properly:

https://github.com/kusti8/LearnCKR/raw/master/The%20C%20Programming%20Language%20-%202nd%20Edition%20-%20Ritchie%20Kernighan.pdf

It teaches you about data structures etc as well, how memory works and how to use it and all the nuances of working in the language which you are going to need.

Only then consider jumping out into embedded C stuff.

If you use a Linux virtual machine or a raspberry pi or something and do it all on there it's probably best. DO ALL THE EXERCISES UNCONDITIONALLY EVEN IF THEY LOOK EASY. They are not as easy as they look ;)

Walk, then jog, then run. Throwing everything into embedded is running from the get go. It's hard enough dealing with the toolchain issues and the environments and weirdness and brokenness without learning the language on top.

Been C programmer both systems programmer on Unix and embedded for 25 years now. Only thing that was worth learning in the long run. To note I started again even though I knew the C fundamentals because what I got taught the wrong way round at university actually hurt me more than it helped me.
« Last Edit: April 23, 2020, 09:32:03 am by bd139 »
 

Offline rstoferTopic starter

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Learning C By Graduated Tutorials
« Reply #10 on: April 23, 2020, 02:39:27 pm »
I have read of the classic version and the ANSI version of "The C Programming Language" described as the "Old Testament" and the "New Testament".  I have both and I'm been carrying the classic version around since the early '80s.  I never thought of these books as tutorial in nature.  I'll have to look again with a different perspective.

I actually use the string and conversion functions in my own projects to avoid any possible requirement to have a heap.
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23018
  • Country: gb
Re: Learning C By Graduated Tutorials
« Reply #11 on: April 23, 2020, 02:51:37 pm »
Yeah they're pretty decent books overall as tutorials. The first edition is probably only for historical value however. 2nd edition is exceptionally good.

I tend to have a skim through every 10 years or so as a refresher. Sometimes you get wrapped up in allocating structs galore on larger projects because it's cheap but it's just brain damage from dealing with java/c# etc so needs unlearning!  :-DD

Amazing what you can achieve without a heap + allocator. Plus there's one in the book if you need it and it explains how it works :)
 

Offline typoknig

  • Regular Contributor
  • *
  • Posts: 103
Re: Learning C By Graduated Tutorials
« Reply #12 on: April 24, 2020, 02:33:07 am »
I would learn C first then learn how to apply it to embedded systems.

The book I learned from is available here and is the one true C book. It's written by the guys who actually wrote C and is concise and drags you through the entire language properly:

https://github.com/kusti8/LearnCKR/raw/master/The%20C%20Programming%20Language%20-%202nd%20Edition%20-%20Ritchie%20Kernighan.pdf

It teaches you about data structures etc as well, how memory works and how to use it and all the nuances of working in the language which you are going to need.

Only then consider jumping out into embedded C stuff.

If you use a Linux virtual machine or a raspberry pi or something and do it all on there it's probably best. DO ALL THE EXERCISES UNCONDITIONALLY EVEN IF THEY LOOK EASY. They are not as easy as they look ;)

Walk, then jog, then run. Throwing everything into embedded is running from the get go. It's hard enough dealing with the toolchain issues and the environments and weirdness and brokenness without learning the language on top.

Been C programmer both systems programmer on Unix and embedded for 25 years now. Only thing that was worth learning in the long run. To note I started again even though I knew the C fundamentals because what I got taught the wrong way round at university actually hurt me more than it helped me.

I tell everyone that wants to start SW development that if they want to lay a good foundation, that is the book to start with.  Since so many other languages are based on C, it just makes sense to start at the source.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf