Warning

 

Close

Confirm Action

Are you sure you wish to do this?

Confirm Cancel
BCM
Member Login

Posted: 9/26/2012 6:38:01 AM EDT
I have always had a desire to learn C, but never a good reason to do so.

My primary target would be Linux and Micro-controllers.
so it seams C would be a good choice since I can use it both places.

Any thought from Real programmers.

PS: This would be for my enjoyment and not for a job etc.

Thank you

Link Posted: 9/26/2012 6:40:14 AM EDT
Yes, and without reservation.
Link Posted: 9/26/2012 6:42:06 AM EDT



Quoted:


Yes, and without reservation.






 
Link Posted: 9/26/2012 6:44:59 AM EDT
there is never a reason not to learn a new language.
Link Posted: 9/26/2012 6:45:25 AM EDT
Straight ANSI C is what I'm thinking
Link Posted: 9/26/2012 6:53:17 AM EDT



Quoted:


Straight ANSI C is what I'm thinking



Good call.  I'm old-school, and think that every C programmer needs to have The C Programming Language, Kernighan and Ritchie.



If you're a UNIX kind of guy, you might enjoy the hell out of The UNIX Programming Environment, Kernighan and Pike, which gets you under the hood with your newfound C skills.





 
Link Posted: 9/26/2012 6:58:58 AM EDT



Quoted:





Quoted:

Straight ANSI C is what I'm thinking



Good call.  I'm old-school, and think that every C programmer needs to have The C Programming Language, Kernighan and Ritchie.



If you're a UNIX kind of guy, you might enjoy the hell out of The UNIX Programming Environment, Kernighan and Pike, which gets you under the hood with your newfound C skills.



 


All of this.

 
Link Posted: 9/26/2012 7:01:45 AM EDT
C is very useful.

I use it for a lot of stuff - it's better suited for some things than C++, C#, and others. you can write some very small footprint code for use in micro controllers.  I also used to do a lot of system level programming - close and tight with the OS and preferred C over assembler.

If you can code C decently, you can pick up any language.
Link Posted: 9/26/2012 7:02:48 AM EDT
Quoted:

Quoted:
Straight ANSI C is what I'm thinking

Good call.  I'm old-school, and think that every C programmer needs to have The C Programming Language, Kernighan and Ritchie.

If you're a UNIX kind of guy, you might enjoy the hell out of The UNIX Programming Environment, Kernighan and Pike, which gets you under the hood with your newfound C skills.

 



Yep that is the book I am looking at.

As a Bonus I have a C Programmer who sits next to me at work who is willing to help me along.

Link Posted: 9/26/2012 7:03:02 AM EDT
A little dry reading never hurt anybody.






 
Link Posted: 9/26/2012 7:03:48 AM EDT
Quoted:
C is very useful.

I use it for a lot of stuff - it's better suited for some things than C++, C#, and others. you can write some very small footprint code for use in micro controllers.  I also used to do a lot of system level programming - close and tight with the OS and preferred C over assembler.

If you can code C decently, you can pick up any language.




Thank you

close and tight is one of the things I'm looking for in a language
Link Posted: 9/26/2012 7:05:40 AM EDT



Quoted:


A little dry reading never hurt anybody.



http://www-inst.eecs.berkeley.edu/~cs61c/su12/images/K&R.jpg

 


I treasure my copy.

 



As an aside, it's a blueprint for how programming books should be written. Authors, take note.




These 800+ page monsters are a travesty. Utterly worthless.
Link Posted: 9/26/2012 7:06:24 AM EDT
Quoted:
A little dry reading never hurt anybody.

http://www-inst.eecs.berkeley.edu/~cs61c/su12/images/K&R.jpg
 


That's the one

Link Posted: 9/26/2012 7:06:45 AM EDT



Quoted:



Quoted:




Quoted:

Straight ANSI C is what I'm thinking



Good call.  I'm old-school, and think that every C programmer needs to have The C Programming Language, Kernighan and Ritchie.



If you're a UNIX kind of guy, you might enjoy the hell out of The UNIX Programming Environment, Kernighan and Pike, which gets you under the hood with your newfound C skills.



 






Yep that is the book I am looking at.



As a Bonus I have a C Programmer who sits next to me at work who is willing to help me along.





I don't actually have a lot of respect for C programmers who haven't read that book. I have a hard time even calling them C programmers, if I'm honest.

 



There are a lot of C programmers right here on arfcom too, if you get stuck.
Link Posted: 9/26/2012 7:08:52 AM EDT
If your target is something like the arduinos I've gotten into, then yes. Knowing some basic C will help with the arduino language as well as the C based langs a few other micros use. There is a lot lurking under the covers (Im just starting into registers) but knowing C at least a little will help a ton at the beginning.

Knowing it is also a good intro to programming/scripting in general. Making my first chron script for a Linux server last week was not hard at all once I learned the syntax and operators. That is something I can attribute directly to working with my first vbs based hta three years ago and the subsequent vba, .net, and c-based arduino stuff since then. Once you understand good programming practice and how to use common statements it's all pretty much the same with the major languages... object-oriented languages will add some new twists though.
Link Posted: 9/26/2012 7:12:52 AM EDT



Quoted:





Quoted:

A little dry reading never hurt anybody.



http://www-inst.eecs.berkeley.edu/~cs61c/su12/images/K&R.jpg

 


I treasure my copy.    



As an aside, it's a blueprint for how programming books should be written. Authors, take note.




These 800+ page monsters are a travesty. Utterly worthless.


Strostrup is 1268 pages



But your argument is still valid.



 
Link Posted: 9/26/2012 7:14:35 AM EDT



Quoted:


I have always had a desire to learn C, but never a good reason to do so.



My primary target would be Linux and Micro-controllers.

so it seams C would be a good choice since I can use it both places.



Any thought from Real programmers.



PS: This would be for my enjoyment and not for a job etc.



Thank you







Yes.  Go for it.

But stay away from C++.





 
Link Posted: 9/26/2012 7:15:40 AM EDT
Ordered the book



Thanks all
Link Posted: 9/26/2012 7:28:56 AM EDT
I find a little competition can help the learning process:

Crobots
Link Posted: 9/26/2012 7:30:11 AM EDT
Do it
Link Posted: 9/26/2012 7:40:40 AM EDT
Quoted:
I have always had a desire to learn C, but never a good reason to do so.

My primary target would be Linux and Micro-controllers.
so it seams C would be a good choice since I can use it both places.

Any thought from Real programmers.

PS: This would be for my enjoyment and not for a job etc.

Thank you




I get the impression there are a lot of OLD SCHOOL programmers in this thread.

By the time I got to college (10 years ago) they were already teaching C++, these days the kids dive straight into PYTHON.  Starting with C will give you some good insight into the fundamentals of programming but you mentioned programming for enjoyment.  If what you're really interested in is buying some open source toys (arduino, etc) and making them work, I say start with PYTHON.

These languages are all close cousins but I think it makes good sense for someone learning on their own to go the open source route since access to helpful coding examples is basically free.

Link Posted: 9/26/2012 8:08:41 AM EDT
Quoted:
I have always had a desire to learn C, but never a good reason to do so.
My primary target would be Linux and Micro-controllers.
so it seams C would be a good choice since I can use it both places.
Any thought from Real programmers.

i have some experience in both facets ("big iron" and uC's) and suggest the following...

learning C on a Linux box is logistically easier, and moreover the code/run/debug cycle is much faster.  by this i mean that getting "hello world" to output on the console via your first C program is trivial on Linux, but getting "hello world" to come out the serial port of a uC (such as a PIC or Atmel) is a different story altogether.  the latter requires a more detailed knowledge of the hardware itself and the device-specific libraries for handling I/O, and moreover understanding how to load compiled code to the uC in the first place.

hence i think you should approach your C learning by 1) buying the K&R C text, 2) coding/modifying examples on a Linux box using off the shelf gcc.  it will be useful for you to also understand basic makefile construction as well.  it will not be helpful (initially) to inspect "large" open source applications –– if you are wondering what i mean by this you can look at the openssl source and you'll quickly conclude i was right.  

using the GNU toolchain under Linux is well documented in many, many how-to tutorials on the web and available in hardcover texts.  you could also look for a community college class on C; at the least you'll discover some things that would not have been readily apparent by self-instruction.  moreover, you'll be exposed to things that you may not have thought through –– string buffer overrun (easy to do in C), order of operations (PEMDAC and operator precedence), uninitialized pointer scenarios (easy to do in C), error handling/escaping (not so easy to do is C), typecasting and promotion (very easy to get wrong in C), etc etc etc.  these are often boundary conditions in your code but understanding these topics is important to writing good code.

ps:
you can see some aspects of my DIY home monitoring/automation system here:  
http://www.ar15.com/forums/t_1_5/1286259__ARCHIVED_THREAD____Show_me_your_HOME_network_boxes.html&page=2#i32303468
and here
http://www.ar15.com/forums/t_10_22/652956_side_of_house__wall___eave__mount_for_an_antenna_.html&page=4#i11240830

the sensors are based on PIC microcontrollers (with code produced using CCS C), and a lightweight Linux box as the central controller (code in C and shell).

ar-jedi

ETA

http://www.ar15.com/forums/t_1_5/833617__ARCHIVED_THREAD____Everyone_I_have_given__C__programming_help_can___.html&page=3#i16585577



Link Posted: 9/26/2012 8:19:56 AM EDT
Quoted:
Quoted:
I have always had a desire to learn C, but never a good reason to do so.

My primary target would be Linux and Micro-controllers.
so it seams C would be a good choice since I can use it both places.

Any thought from Real programmers.

PS: This would be for my enjoyment and not for a job etc.

Thank you




I get the impression there are a lot of OLD SCHOOL programmers in this thread.

By the time I got to college (10 years ago) they were already teaching C++, these days the kids dive straight into PYTHON.  Starting with C will give you some good insight into the fundamentals of programming but you mentioned programming for enjoyment.  If what you're really interested in is buying some open source toys (arduino, etc) and making them work, I say start with PYTHON.

These languages are all close cousins but I think it makes good sense for someone learning on their own to go the open source route since access to helpful coding examples is basically free.





Actually I program the Atmel AVR chips now using basic but want to switch to something more mainstream

Link Posted: 9/26/2012 2:47:13 PM EDT
Since I ordered this





Should I also get this?

Link Posted: 9/26/2012 8:13:15 PM EDT
I took a class on Linux Systems Programming in C.  It was awesome.  It would probably be good to start by learning C first.  Learning in a classroom environment is much easier that trying to learn on your own (at least for me it was).


Also, the K&R is a great book.  It not meant to be a book for learning to program.  They even say that in the book.  It is a book for people that know how to program who want to learn C.  Either way for any C programmer it is a must have.

Link Posted: 9/26/2012 8:17:34 PM EDT
Learn Assembly too for a fun ride...
Link Posted: 9/26/2012 9:21:20 PM EDT
Quoted:
Quoted:
I have always had a desire to learn C, but never a good reason to do so.

My primary target would be Linux and Micro-controllers.
so it seams C would be a good choice since I can use it both places.

Any thought from Real programmers.

PS: This would be for my enjoyment and not for a job etc.

Thank you




I get the impression there are a lot of OLD SCHOOL programmers in this thread.

By the time I got to college (10 years ago) they were already teaching C++, these days the kids dive straight into PYTHON.  Starting with C will give you some good insight into the fundamentals of programming but you mentioned programming for enjoyment.  If what you're really interested in is buying some open source toys (arduino, etc) and making them work, I say start with PYTHON.

These languages are all close cousins but I think it makes good sense for someone learning on their own to go the open source route since access to helpful coding examples is basically free.



i know i'm an old fuck, but good god!!!!

i started out cranking straight machine code.

got really frisky once we transitioned to doing that newfangled assembler shit.

eventually the HOL phase hit, and truth be told pascal is my favorite from that era, original C was fucking horrible. flaky as shit, you could stomp on your registers way too easily, run time errors out the ass.  you were far better off linking up majority pascal code with specific assembler code.

c++ is actually decent.

there was also an ADA phase in there that i barely remember, but i do remember it being pretty solid.

if you are just getting started, please don't be sucked into the "modern languages only" hype.  learn some low level shit, the market isn't that big, but when a customer needs some serious low level support you can differentiate yourself like a sum-bitch.  plus it's a blast.

ps: never even heard of python, gonna have to look into it.
Link Posted: 9/26/2012 9:25:44 PM EDT
Arduino kit.  Easy to learn, easy to play with, fun.




Quoted:


I have always had a desire to learn C, but never a good reason to do so.



My primary target would be Linux and Micro-controllers.

so it seams C would be a good choice since I can use it both places.



Any thought from Real programmers.



PS: This would be for my enjoyment and not for a job etc.



Thank you









 
Link Posted: 9/26/2012 9:30:51 PM EDT
A few years ago I needed to program an 8-bit Atmel microcontroller and learned their assembly language.  It was very similar to 6502 which I'd done before so it wasn't really that difficult for me figure it out.

Anyway, knowing C++ isn't a bad thing.  When I was in school they were still using Pascal/Delphi as the 'teaching' language.
Link Posted: 9/26/2012 9:53:01 PM EDT
Quoted:
A few years ago I needed to program an 8-bit Atmel microcontroller and learned their assembly language.  It was very similar to 6502 which I'd done before so it wasn't really that difficult for me figure it out.

Anyway, knowing C++ isn't a bad thing.  When I was in school they were still using Pascal/Delphi as the 'teaching' language.


Pascal/Delphi is how I got into programming.

Got some library books and went to town.
Link Posted: 9/26/2012 10:03:21 PM EDT
pascal is still my favorite language to get folks started on.

it may be "obsolete", but it generates one hell of a solid foundation.

Link Posted: 9/27/2012 2:08:20 AM EDT
On a related note.

I haven't done any C programming at home since probably the early part of this century, using a Borland compiler (which I still have). Mostly, I've made programs for web address sorting, but I'm toying with again, at least at this moment, of building an AI construct.

I am thinking of getting a new lap top, but haven't gotten around to yet. While one would think there shouldn't be an issue, is one kind of lap top better than another for programing? Not thinking of graphics here, just a text interface.
______________________________________________________________________________________________
("Want to play a game?"––WOPR, (w,stte), "War Games")
Link Posted: 9/27/2012 6:09:44 AM EDT



Quoted:

I am thinking of getting a new lap top, but haven't gotten around to yet. While one would think there shouldn't be an issue, is one kind of lap top better than another for programing? Not thinking of graphics here, just a text interface.



Not really, unless you're going to be compiling massive projects, in which case you'll want the fastest processor you can afford.

 



But otherwise, get whatever you want, in a color that blows your skirt up, at a price you can live with.




If for some reason you're not going to be using an external monitor, you'll probably want the largest display you can get your hands on.




I do all of my shell-only C stuff on a Mac, for what it's worth. I've got the normal UNIX toolchain: gcc, make, etc.
Link Posted: 9/27/2012 8:21:49 AM EDT
Quoted:
Since I ordered this





Should I also get this?



Link Posted: 10/8/2012 6:03:03 PM EDT

so

$ gcc -o arfcom hello_world.c

does what now?

ar-jedi  
Link Posted: 10/9/2012 5:36:26 AM EDT



Quoted:




Since your not doing this in a classroom, I probably would.

 
Top Top