General Discussions => General discussions => Topic started by: redhot1 on May 01, 2017, 04:42:51 PM Return to Full Version

Title: Learning the C programming language
Post by: redhot1 on May 01, 2017, 04:42:51 PM
I'm starting to learn about programming in C programming language. I'm using a book to learn from. Are there other programmers who know the language here? I'm sort of new to programming, though I only made it so far in the Python programming tutorials. I don't think me and Python click at first, but I'll try it again later. I'll be finished or almost finished with my book near mid-July.
Title: Re: Learning the C programming language
Post by: KathyLauren on May 01, 2017, 04:47:22 PM
I had been an experienced programmer for years when I first tried to learn C just because, in the biz, you have to know it at least a bit.  It has to be the world's most hideous programming language.  There's an apocryphal story that the inventors of C deliberately set out to write the most inelegant language they could come up with and were surprised when it was taken seriously.

If you just want to learn programming, there are easier languages.  But if you need to learn C because you need it for a job or a project or something, you have my sympathies.
Title: Re: Learning the C programming language
Post by: HereComesTheRain on May 01, 2017, 04:55:51 PM
I'm a computer science major, though admittedly only in my first year. C is a fine language but from what I understand C#, or even more so C++, are simpler and more widely used. Python is a good beginning language for the C languages because they're both object-oriented script-based languages. If you find Python a little unwieldy, Lua is an even simpler beginner language, its the first one I ever learned, but its not near as powerful as the others and is a purely scripting based language.
Title: Re: Learning the C programming language
Post by: stephaniec on May 01, 2017, 04:57:44 PM
you'd probably be better off leaning C+ , it's easier
Title: Re: Learning the C programming language
Post by: femfem on May 01, 2017, 05:03:12 PM
Quote from: redhot1 on May 01, 2017, 04:42:51 PM
I'm starting to learn about programming in C programming language. I'm using a book to learn from. Are there other programmers who know the language here? I'm sort of new to programming, though I only made it so far in the Python programming tutorials. I don't think me and Python click at first, but I'll try it again later. I'll be finished or almost finished with my book near mid-July.
You're starting with C?!?! I know PHP (probably almost advanced PHP, actually), Python, SQL, JavaScript, model-view-controller frameworks, and object-oriented programming.  And even I don't know if I'd want to program in C.  Java is probably equivalent, in respect to difficulty, and I won't even begin learning it until August lol.

I strongly recommend trying Python again, and I have tons and tons of notes you can use for it.  You have to make it hands-on, btw....practical, as opposed to just theoretical. :)

K.C.
Title: Re: Learning the C programming language
Post by: AnneK on May 01, 2017, 05:05:04 PM
While I have never been a professional programmer, I have done small amounts, both at work and home.  I've learned over the years, FORTRAN, BASIC, Pascal, C, Python, REXX, Bash along with 8080, 6502, 6809, 8088 & Data General Nova/Eclipse assembler.  Even worked in octal and hex on some systems, not to mention AMD AM2901 bit slice processor.  Other than that, no experience at all.    ;)
Title: Re: Learning the C programming language
Post by: femfem on May 01, 2017, 05:08:31 PM
Quote from: AnneK on May 01, 2017, 05:05:04 PM
While I have never been a professional programmer, I have done small amounts, both at work and home.  I've learned over the years, FORTRAN, BASIC, Pascal, C, Python, REXX, Bash along with 8080, 6502, 6809, 8088 & Data General Nova/Eclipse assembler.  Even worked in octal and hex on some systems, not to mention AMD AM2901 bit slice processor.  Other than that, no experience at all.    ;)
Okay, but you're saying that you can't click with Python lol. That's like the most basic of programming languages, except for maybe VBA lol.  So, do you actually know the aforementioned applications, or are you just saying that you've used them, similar to how Americans always say they know Spanish? lol
Title: Re: Learning the C programming language
Post by: Alanna1990 on May 01, 2017, 05:14:46 PM
C is a horrible abomination of mankind, I tried before, but no, I just gave up, and now instead of thinking people that know C are gurus, they must be fanboys or something, just choose another language, a lot of them are more accessible and usable for today's devices, try .net for example
Title: Re: Learning the C programming language
Post by: DawnOday on May 01, 2017, 05:54:57 PM
Here are some free sources for programming. Not for C or C++ but if you don't know programming basics or haven't used them in a while, they can help.  https://www.khanacademy.org/#/computing
Another online source is http://Lynda.com This is approx $40 a month for over 2000 courses including C++, C, Java, Ruby, Ruby on rails,
Finally there is MIT ONLINE a free source for University level education including computer science which includes c++
https://ocw.mit.edu/index.htm
I've tried them all. 
Title: Re: Learning the C programming language
Post by: AnneK on May 01, 2017, 10:03:00 PM
QuoteOkay, but you're saying that you can't click with Python lol. That's like the most basic of programming languages, except for maybe VBA lol.  So, do you actually know the aforementioned applications, or are you just saying that you've used them, similar to how Americans always say they know Spanish? lol

I don't understand your point on Python.  That's one of the ones I mentioned.  I came about those for a variety of reasons.  Some for personal interest or working with my own computer, some for work where I was a technician maintaining those old "mini computers", where I had to work with the intstruction sets and some were part of college programs I took.
BTW, I mentioned AM2901.  That was a bit slice processor, which was often used in mini computer CPUs.  The Data General Eclipse used 4 of them and the microcode for running them was over 100 bits wide!  That was the level I worked at on those systems.

Title: Re: Learning the C programming language
Post by: Gertrude on May 01, 2017, 10:51:04 PM
I took it when I got my masters. Wrote it and compiled on my Mac first then compiled for windows for submission to the teacher. Sometimes it would work on one and not the other, but I got the incompatibilities worked out. I never really programmed before that or after.


Sent from my iPhone using Tapatalk
Title: Re: Learning the C programming language
Post by: Michelle_P on May 02, 2017, 08:05:29 AM
Oh, Hi there!

I've been programming primarily in C, along with Objective C and a family of related languages since 1983.  I've written a fair bit of code, and have been an instructor.  Resumé here... (https://www.linkedin.com/in/michaelpaquette/)

I'm not interested in debating the merits of languages.  They're all just tools designed for various tasks.  I'll be happy to assist the OP and others with any questions they may have.
Title: Re: Learning the C programming language
Post by: ainsley on May 02, 2017, 08:16:04 AM
I like C\C++ and like my professor used to say, if you learn C or C++ then you can teach yourself any other language.  I used C for operating system programming (debian linux) and had several semesters of C++, but never wrote professionally with either.  Like it or hate it, C is the kernel language of most OS's.  It is a good thing to know.  Just knowing them makes it so easy to read other languages, too.
Title: Re: Learning the C programming language
Post by: Gertrude on May 02, 2017, 09:18:41 AM
Quote from: ainsley on May 02, 2017, 08:16:04 AM
I like C\C++ and like my professor used to say, if you learn C or C++ then you can teach yourself any other language.  I used C for operating system programming (debian linux) and had several semesters of C++, but never wrote professionally with either.  Like it or hate it, C is the kernel language of most OS's.  It is a good thing to know.  Just knowing them makes it so easy to read other languages, too.
Yeah, Mac OS uses objective c and windows calls it c#, but I've heard there's little relation to the other c languages. I found it a time suck. I'd work on a puddly problem and two hours would pass before I realized it. I'm not a programmer, so it worked out. :)


Sent from my iPhone using Tapatalk
Title: Re: Learning the C programming language
Post by: ainsley on May 02, 2017, 09:31:05 AM
I thought Windows was C for the kernel and C++ for the rest.  Beats me, though. lol 
I can certainly go down rabbit holes for a couple hours waxing systems programming, too. haha!
Title: Re: Learning the C programming language
Post by: Gertrude on May 02, 2017, 09:36:15 AM
Quote from: ainsley on May 02, 2017, 09:31:05 AM
I thought Windows was C for the kernel and C++ for the rest.  Beats me, though. lol 
I can certainly go down rabbit holes for a couple hours waxing systems programming, too. haha!

I'm not a programmer nor do I play one on tv. I have been computer support and administration for 23 years, a lot with macs and I started with Novell.


Sent from my iPhone using Tapatalk
Title: Re: Learning the C programming language
Post by: ainsley on May 02, 2017, 09:48:55 AM
Quote from: Gertrude on May 02, 2017, 09:36:15 AM
I'm not a programmer nor do I play one on tv. I have been computer support and administration for 23 years, a lot with macs and I started with Novell.


Sent from my iPhone using Tapatalk

I am not a programmer.  I have done a lot of other IT stuff over ten years ago, but I have been doing security, pentesting, and forensics for the last decade, mainly.  However, I find myself reading a lot of different languages doing that work.  I work with all flavors of linux (*nix), mac, and windows.  Not a big fan of novell, tbh. :)
Title: Re: Learning the C programming language
Post by: Kylo on May 02, 2017, 12:31:44 PM
I did have to learn some C for a course a few years back, but it was so interesting to my sieve-like brain it has since completely exited my memory. I recall it being quite a pain to learn.
Title: Re: Learning the C programming language
Post by: Alex81 on May 02, 2017, 05:51:56 PM
I tried kicking C around a bit here and there but never really got the hang of it. I'm primarily a "web developer" for my own stuff and stick with php, mysql, & minimal javascript.
Title: Re: Learning the C programming language
Post by: Gertrude on May 02, 2017, 07:08:17 PM
Quote from: ainsley on May 02, 2017, 09:48:55 AM
I am not a programmer.  I have done a lot of other IT stuff over ten years ago, but I have been doing security, pentesting, and forensics for the last decade, mainly.  However, I find myself reading a lot of different languages doing that work.  I work with all flavors of linux (*nix), mac, and windows.  Not a big fan of novell, tbh. :)

Novell was great 20 years ago and then Microsoft copied the features into active directory. Soon after, Novell was all but history. Been using macs since 1987 and teching them since 1994. Love the OS, just wish I could easily run it on cheaper hardware.


Sent from my iPhone using Tapatalk
Title: Re: Learning the C programming language
Post by: sarah1972 on May 02, 2017, 09:25:00 PM
It mostly depends on your goal for learning a language. That should determine what you learn.  C still has a lot of use. If you are looking for easier languages, C# is and option, so is Swift. Some of the most recent trends are in the high level frame works like Node.js or OSGI. There is also Java still in heavy use.
You really need to decide what your goal is for learning to write code and then see what languages fit best. One think I have noticed: a single language is not enough anymore. I am mostly a C# girl but still have to touch each and any of the languages I mentioned. Mostly requires extensive Google use to get around... PM if you want to talk more about this topic. I have been managing development teams for a few years now and should be able to give some more insights...
Title: Re: Learning the C programming language
Post by: Michelle_P on May 02, 2017, 09:42:35 PM
Redhot1:

The great granddaddy of books to learn C from is:

"The C Programming Language", by Kernighan and Ritchie (https://www.amazon.com/Programming-Language-Brian-W-Kernighan/dp/0131103628/ref=sr_1_1?s=books&ie=UTF8&qid=1493776962&sr=1-1&keywords=c+programming+language).

The thing to remember with this language is that it was designed as a 'portable assembler', a way to write programs that could express common hardware functionality, yet allow programs to be readily moved to new hardware.  The concepts expressed in the language, things like pointers, or addresses of memory storage, and operators like ++ (increment) and -- (decrement) reflect hardware operations on most common processors. 

Just like assembly language, it offers almost no protection against doing things that hardware doesn't support, like setting a pointer to an address that doesn't exist and trying to read the nonexistent contents, or overwriting memory in your program accidentally.  The hardware and assembly language don't protect against these things, and neither does C.

C also does not offer all the nifty features of higher level languages, like strong type checking, memory bounds checks, or automatic memory management.  C is 'down on the metal', with much of the functionality provided by additional libraries of code already written and debugged.  Learning the standard libraries is the biggest task in learning the language.

C is very useful at low level hardware control and manipulation, which is why we see it in things like operating system kernels, where it's light weight 'down on the metal' functionality is very handy.

There are other popular languages in the C family that add functionality in different ways, at the expense of some flexibility and memory use.  C++ was originally written as a set of libraries and a 'front end' that read C++ code and wrote out C code with references to a set of library routines that implemented much of the languages functionality.  It has since gotten its own compilers that generate assembly language and object code (the stuff that runs on the hardware processor) directly.  The language design took a variety of object-oriented programming concepts and tried to implement each one in C++ features.  It features 'strong typing', a type of error check that catches many common programming errors, but also prevents some types of runtime dynamic binding.

Objective-C is a different object oriented model that preserves more C functionality, including C's ability to let you get into trouble with the hardware, while adding a Smalltalk-like object oriented runtime environment that features dynamic binding between modules and very flexible typing.  It has recently had a syntax polish done on it, and had automatic memory management and a few other goodies added to become the Swift programming language.

These sorts of languages can in turn be used to build modern dynamic high level programming languages like Perl, Tcl, and Python.   These languages are deliberately very much abstracted away from the hardware, and hide things like memory management and processor-specific features from the user.  You'll find these languages behind the scenes of processor-independent applications like web-based tools, job control systems, and other fairly abstract (from the hardware) tasks.

The language you learn depends on what you want to do.

I have my biases, of course.  Since I wrote lower level things like hardware read-only-memory code to boot processors, kernels for graphics processors, and window systems, much of my code was written in C.  For more abstract things, I used more abstract tools, of course.

For a large extensible multimedia framework, I used Objective C for its dynamic runtime binding and protocol interface specifications.  I used PostScript to build some UI elements running atop a window system that included a PostScript interpreter, while I wrote the code inside the window system in C.

(Made me look: I have 3.2 million lines of C code, just under a million lines of Objective C, C++, and PostScript code.  No wonder I retired...)
Title: Re: Learning the C programming language
Post by: AnneK on May 03, 2017, 07:42:30 AM
QuoteThere is also Java still in heavy use

Even FORTRAN & COBOL are still in common use.

QuoteThe thing to remember with this language is that it was designed as a 'portable assembler', a way to write programs that could express common hardware functionality, yet allow programs to be readily moved to new hardware.

That's one of the reasons Linux (and Unix) is available on so many platforms.  The source code is available and written in C.
So, you have a new system, you can soon have Linux up & running on it.

BTW, there's quite a history about how Unix and then Linux spread to so many systems.
Title: Re: Learning the C programming language
Post by: Paige on May 03, 2017, 08:54:41 AM
Interesting
Quote from: Michelle_P on May 02, 2017, 09:42:35 PM
Redhot1:

The great granddaddy of books to learn C from is:

"The C Programming Language", by Kernighan and Ritchie (https://www.amazon.com/Programming-Language-Brian-W-Kernighan/dp/0131103628/ref=sr_1_1?s=books&ie=UTF8&qid=1493776962&sr=1-1&keywords=c+programming+language).

The thing to remember with this language is that it was designed as a 'portable assembler', a way to write programs that could express common hardware functionality, yet allow programs to be readily moved to new hardware.  The concepts expressed in the language, things like pointers, or addresses of memory storage, and operators like ++ (increment) and -- (decrement) reflect hardware operations on most common processors. 

Just like assembly language, it offers almost no protection against doing things that hardware doesn't support, like setting a pointer to an address that doesn't exist and trying to read the nonexistent contents, or overwriting memory in your program accidentally.  The hardware and assembly language don't protect against these things, and neither does C.

C also does not offer all the nifty features of higher level languages, like strong type checking, memory bounds checks, or automatic memory management.  C is 'down on the metal', with much of the functionality provided by additional libraries of code already written and debugged.  Learning the standard libraries is the biggest task in learning the language.

C is very useful at low level hardware control and manipulation, which is why we see it in things like operating system kernels, where it's light weight 'down on the metal' functionality is very handy.

There are other popular languages in the C family that add functionality in different ways, at the expense of some flexibility and memory use.  C++ was originally written as a set of libraries and a 'front end' that read C++ code and wrote out C code with references to a set of library routines that implemented much of the languages functionality.  It has since gotten its own compilers that generate assembly language and object code (the stuff that runs on the hardware processor) directly.  The language design took a variety of object-oriented programming concepts and tried to implement each one in C++ features.  It features 'strong typing', a type of error check that catches many common programming errors, but also prevents some types of runtime dynamic binding.

Objective-C is a different object oriented model that preserves more C functionality, including C's ability to let you get into trouble with the hardware, while adding a Smalltalk-like object oriented runtime environment that features dynamic binding between modules and very flexible typing.  It has recently had a syntax polish done on it, and had automatic memory management and a few other goodies added to become the Swift programming language.

These sorts of languages can in turn be used to build modern dynamic high level programming languages like Perl, Tcl, and Python.   These languages are deliberately very much abstracted away from the hardware, and hide things like memory management and processor-specific features from the user.  You'll find these languages behind the scenes of processor-independent applications like web-based tools, job control systems, and other fairly abstract (from the hardware) tasks.

The language you learn depends on what you want to do.

I have my biases, of course.  Since I wrote lower level things like hardware read-only-memory code to boot processors, kernels for graphics processors, and window systems, much of my code was written in C.  For more abstract things, I used more abstract tools, of course.

For a large extensible multimedia framework, I used Objective C for its dynamic runtime binding and protocol interface specifications.  I used PostScript to build some UI elements running atop a window system that included a PostScript interpreter, while I wrote the code inside the window system in C.

(Made me look: I have 3.2 million lines of C code, just under a million lines of Objective C, C++, and PostScript code.  No wonder I retired...)

Nice summary Michelle.    I'm an old C programmer too. Started writing code in C in the 80s, then C++ and Objective C.  I still have my old Kernighan and Ritchie, haven't looked at it in years, but I hate to throw it out. :) I totally agree with you, you need to determine what you want to do, before picking the language. 

Here's a quick list of the languages I would use for different purposes.  These are just my preferences and I haven't really been trying other languages to see if there's better options.

Apple -> Swift
Microsoft Windows -> C#, I think but I've haven't used it for sometime.
Android -> Java
Server side web coding -> Python
Client side web programming -> JavaScript, must say not a big fan, but you use what you have to use.
Statistics -> R

Low level operating system coding, maybe adding performance improvements to high level code   --> C

I switched from Objective C to Swift about 3 years ago.  It's just a matter of time before Apple support for Objective C starts to decline.  They have a habit of doing stuff like that.  Swift is much easier and prettier than Objective C.  It's definitely easier for beginners.  The Swift Playground app for the iPad is definitely something to check out if you're just starting out.

I'm amazed you still have all your old code Michelle.  I have no idea how many millions of lines I've written or modified over the years.

Take care,
Paige :)


Title: Re: Learning the C programming language
Post by: ainsley on May 03, 2017, 09:08:36 AM
Quote from: Michelle_P on May 02, 2017, 09:42:35 PM
C also does not offer all the nifty features of higher level languages, like strong type checking, memory bounds checks, or automatic memory management. 

I can vouch for the lack of memory management!!  I used to get dinged in college for not returning memory space so much! lol  Nightmare flashbacks of my minor foray into C programming...ugh.  Thanks, Michelle! LOL
Title: Re: Learning the C programming language
Post by: KarynMcD on May 04, 2017, 02:46:13 PM
I've been programming since 1982 starting with Applesoft Basic and now mostly program in C# and PHP, building websites and desktop applications.

This is important:
Quote from: sarah1972 on May 02, 2017, 09:25:00 PM
It mostly depends on your goal for learning a language. That should determine what you learn.

What is your goal and what is your passion?
Writing mobile apps, building websites, working in a business, etc...?
Title: Re: Learning the C programming language
Post by: Chloe on October 14, 2017, 09:15:14 AM
Quote from: sarah1972 on May 02, 2017, 09:25:00 PM
It mostly depends on your goal for learning a language. That should determine what you learn.
Quote from: KarynMcD on May 04, 2017, 02:46:13 PM
What is your goal and what is your passion?

I second third this is 100% true. Best way to learn a language, any language (including ie: French?) is to have a point, something you actually want to accomplish. It's akin to my grandbaby only crying 'no' as opposed to her saying "this, I want grape" or "don't like red flavor"!! Learning 'code words' to express what one's heart desires!!

There's a logic flow, desired meaning in all those interconnected lines of code!!

I find PHP and C to be virtually identical, easy to port only difference being one is interpreted "on the fly" and the other is compiled into machine readable binary in advance. Assembly is entirely different in that it's hexidecimal command syntax (base 16) is wholly dependant on the hardware processor you are targeting. Documentation ';' for us humans is essential!!
;********************************
; S T A R T O F R O M
;********************************
;Trap14-TransmitByteA - Sends a byte to the IRD
; r00 (A) – Byte to send to IRD
; r01 (B) – Working register for IOLine manipulation
; r02 - Bit count
; r03 - Used for DelayC0C1 function
; r04 - Stores original B value
; r05 - Bit 0 is used as the parity sum bit
; r24 - Original A value
TransmitByteA:
C000 : 76 02 D0 07  btjo #02,CardStatus,C00B    ; if debug mode, branch to C00B
C004 : 8C 28 92     br Vector2892           ;2892->3EEB
C007 : 00 00        jmp C009            ; kill a few cycles
C009 : 00 5F        jmp C06A            ; jump back into xmit loop
--------------------Setup   ---
C00B : 77 04 CF 06  btjz #04,CommSettings,C015  ; If CommDirection is set to TX, skip to C015
C00F : 8E C1 71     call DelayC171          ; Otherwise call the defective delay function
C012 : 75 FB CF     and #FBh,CommSettings       ; Set the CommDirection to RX
C015 : D0 24        mov A,24h           ; Store A into r24
C017 : D1 04        mov B,04            ; Store B into r04
C019 : 30 20 12 01  mov &XmitCalibration,01     ; Set B to xmit start calibration value /; Xmit Start Delay
C01D : FF           nop             ; kill a cycle or so
C01E : C6           tst B                       ; See if calibration value = 0
C01F : 02 23        jz C044         ; B = 0?, if so, skip delay, jmp to C044
C021 : 00 11        jmp C034            ; otherwise, jump to xmit start delay
--------------------
C023 : FF           nop             ; kill a cycle


Any older crowd here familar with "Pirate Den" based out of Canada?? It's how I cut my baby teeth on internet forums . . .  >:-)

In a sense I view "transition" in the same manner. It's one thing to want to more naturally convey one's inner emotions and desires via a different, more innate gender 'language' but if the 'point', desired end result is total social/work life disruption then how 'successful' @ goals are we being really??
Title: Re: Learning the C programming language
Post by: Bari Jo on October 14, 2017, 09:23:45 AM
I've programmed in a variety of languages including C, lua, JavaScript, MEL, Python, 4DXL and JSON.  I've never had any formal training, just cracked a book, searched the web for help, etc.  the most popular in my industry is Python (visual effects).  I also found it the easiest.  Which ever you chose a good resource is Coursera.  I've gone through those classes sometimes when on business trips.  They are free, and online.
Title: Re: Learning the C programming language
Post by: elkie-t on October 14, 2017, 09:52:02 AM
Ancient language, used nowadays only to write interfaces to hardware. Unless you know why you want it, I'd recommend not to waste your time.

Having said that - it's not that difficult to learn, it's just difficult to write anything big enough to be useful.


Sent from my iPhone using Tapatalk
Title: Re: Learning the C programming language
Post by: Laurie on October 14, 2017, 10:03:41 AM

  Programmers are the enemy.  Or at least in the good ol' days it seemed that way. I was a hardware tech and you had to rub a software problem in a programmer's face to get them to even look into it. Today that problem is still there though everything is done with code these days. I hated to see it happen. Hardware just broke and could be fixed. Programming just makes things act flakey and no one is interested in fixing it.

  Yes I do have an old school prejudice. Sorry.

Hugs  (even for you programmers) lol
  Laurie
Title: Re: Learning the C programming language
Post by: Roll on October 14, 2017, 10:20:45 AM
Odds are the OP has moved on, but interesting topic nonetheless so I'll jump in...

Quote from: elkie-t on October 14, 2017, 09:52:02 AM
Having said that - it's not that difficult to learn, it's just difficult to write anything big enough to be useful.

A course I had over the summer required a crash course in C out of nowhere after the degree program had been 99% Java up until that point, all for a brief lesson to demonstrate process and memory manipulation. A lot of people did not do well, heh. I agree though, it really is't hard, just mostly pointless. (Though to be fair I had previous experience, so just had to do a refresher. Most people in my course thought it was the hardest thing they've ever done.)

For my part, I've dealt mostly with Java simply because it is the standard for the field I work with the most. I'm android development-centric anyway, so works for me. I've been trying to make myself stop and work more in Python, and probably will go all out on it next year when my course load drops off to almost nothing, since I know it is the language of choice in a Georgia Tech program I want to get into. Really I should be working on it now, but dealing with the transgender issue has sort of become all consuming of my free time. ;D
Title: Re: Learning the C programming language
Post by: Dena on October 14, 2017, 12:28:30 PM
Quote from: elkie-t on October 14, 2017, 09:52:02 AM
Ancient language, used nowadays only to write interfaces to hardware. Unless you know why you want it, I'd recommend not to waste your time.

Having said that - it's not that difficult to learn, it's just difficult to write anything big enough to be useful.


Sent from my iPhone using Tapatalk
I would disagree with that point. I wrote and maintained over 100,000 lines of assembler which was the heart of a protocol converter. There wasn't a single line of high level code in the entire unit. As to the why, the amount of work the unit had to do couldn't afford inefficient high level code. We could have made the hardware vastly more complex and costly by throwing more processors at it however our largest unit required about 3 feet of rack space for 256 ports of RS232 and more processors=more boards=more rack space. As it was, one 68ec030 could comfortably handle 16 ports and all the additional processing overhead on a single board running at high baud rates.
Title: Re: Learning the C programming language
Post by: elkie-t on October 14, 2017, 04:38:28 PM
Quote from: Dena on October 14, 2017, 12:28:30 PM
I would disagree with that point. I wrote and maintained over 100,000 lines of assembler which was the heart of a protocol converter. There wasn't a single line of high level code in the entire unit. As to the why, the amount of work the unit had to do couldn't afford inefficient high level code. We could have made the hardware vastly more complex and costly by throwing more processors at it however our largest unit required about 3 feet of rack space for 256 ports of RS232 and more processors=more boards=more rack space. As it was, one 68ec030 could comfortably handle 16 ports and all the additional processing overhead on a single board running at high baud rates.
So, what are disagreeing with?
a) I stated that the only place pure C is still has place is in communication with hardware - and your code happens to be there.

b) I stated that C is difficult to maintain if the application is big enough - that's why the whole world moved on to C++ and more object-oriented languages.
You're throwing at me an example of an assembler... I personally believe they are about the same in maintenance difficulty, but I never said it is not possible :) - someone needs to write those drivers for those switchboards, someone will maintain them while they are in use.

c) there could be some good reasons to learn C, as long as it's an exercise for mind over a weekend, if someone knows already programming with C++, or if he wants to go into development of drivers.

d) not to brag, but I happen to know C, I wrote one driver, I knew 2 assembler languages (ibm 370, and intel 8086), wrote a few programs with C++ (some before Windows came, some after, some for other OS), you can imagine I knew most languages used in 80&90s - I call them all ancient, since technology moved on so much more - and OOP is definitely progressed a lot with Java and C#, and even C++ isn't what it used to be then.
Title: Re: Learning the C programming language
Post by: Chloe on October 14, 2017, 05:45:47 PM
Quote from: Bari Jo on October 14, 2017, 09:23:45 AM. . . a good resource is Coursera. 

Sorry ladies didn't mean to start something. I explored assembly on the "TMS370/P3 microcontroller" in part because many development applications were designed around it. Still have my SDLogic chip reader via a 9pin RS232 port but gotta admit, rather absolete now. Think it still works up to Windows 7. Anyone still use UltraEdit32??

Aside: still have, in attic somewhere, original hardbound "IBM Technical Reference Manual(s)"
for 8086 processor!! You know, the one's cloners "Jobs and Gates" couldn't look at, let alone copy due copyright concerns.

Gotta agree with Laurie: an "old school prejudice"!

Bari Jo, checked out your on-line course suggestion: "Deep Learning Specialization" "Break into AI" sounds very cool, used to play around with learning image processing using weighted linked lists in "Turbo Pascal" (on a Apple IIe no less!!!)

Oh, to find the peace & quiet time!!!

Title: Re: Learning the C programming language
Post by: chris.deee on October 15, 2017, 01:32:32 AM
Quote from: ainsley on May 02, 2017, 09:31:05 AM
I thought Windows was C for the kernel and C++ for the rest.  Beats me, though. lol 
I can certainly go down rabbit holes for a couple hours waxing systems programming, too. haha!

That is correct. 

Every major OS kernel is written predominantly in C, not c++. 

Windows (ntoskrnl.exe), Android (Linux kernel), MacOS/iOS (BSD Unix kernel).  All written in C.

This is largely historical, as the state of C++ compilers when these kernels were started wasn't that great. 

OS layers above the kernel are typically written in C++, or on MaxOS/iOS, objective C. 


Sent from my iPhone using Tapatalk
Title: Re: Learning the C programming language
Post by: Paige on October 15, 2017, 09:44:27 AM
Quote from: chris.deee on October 15, 2017, 01:32:32 AM
OS layers above the kernel are typically written in C++, or on MaxOS/iOS, objective C. 

I imagine Apple is writing most of its new higher level OS code in Swift now.  There would still be a lot of historical Objective C but I can't see them doing much new considering how how much they push Swift to developers.

Paige :)
Title: Re: Learning the C programming language
Post by: Chloe on October 15, 2017, 11:19:49 AM
Quote from: Bari Jo on October 14, 2017, 09:23:45 AMI've gone through those classes sometimes when on business trips.  They are free and online.
Bari Jo after 7 day free trial courses are $49/month. Still a good deal I too am 'self-taught' for the most part. Used to pick up programming manuals like others read fiction. The question remains: who has the time?

Just installed "Grammarly for Chome" anybody else discover this??
Title: Re: Learning the C programming language
Post by: AnneK on October 15, 2017, 11:38:23 AM
Coursera used to be free.  I took a few courses, including Python.
Title: Re: Learning the C programming language
Post by: Steph Eigen on October 15, 2017, 02:14:36 PM
Michelle's summary is excellent.

I have a complementary perspective.  I'm not a professional programmer but have done hideously large quantity of coding over my career for the purpose of scientific data analysis and modeling.  In the 70's I learned to program initially in various languages on DEC hardware, PDP-8 and 11 and DECsystem 10 (PDP-10).  Mostly Fortran IV but some other languages not in current use.  When moving some of our work toward interfacing computer directly to instruments for data acquisition using DEC PDP-1140/LPS hardware, I had to code in PDP-11 assember to tighten the code and carefully optimize memory usage given the very limited resources available with these machines.   I learned a lot about the hardware and efficient coding as a result of this work but hated having to work at this low level programing.  Apparently simple tasks seemed to take an awfully large effort  to accomplish.  I was not into the beauty of an excellent hack, I just wanted to do the science, get the data, get on with the work.

Since then, I've programmed just about every version of Fortran including the current versions which include object oriented features and  structured programming constructs.  I've also programmed  to a lesser extent in Forth, Visual Basic, Pascal, Lisp, Modula, Smalltalk, Python and the Unix shell scripting languages and dabbled a bit in C and its variants. 

In any case, aside from legacy code maintenance, and an occasional shell script, I haven't written in any of these languages for years.

For scientific uses, languages such as Matlab, Mathematica and open source work alikes such as SciLab offer high level solutions that allow efficient problem solving without having to muddle through the complexity of coding at lower levels.  In the statistical arena, STATA, SAS, and S/S-Plus are similarly high level packages that are very efficient for rapid development of problem solving solutions.  The R programming language is an open source version of S that is a standard in statistical data analysis with a myriad of user contributed packages that span just about every purpose imaginable.

The big problem I faced in the early days was the need to optimize code given hardware limitations.  In the current era, it is less of an issue since most compilers have sufficiently sophisticated internal logic to optimize the resulting binary executables for speed and memory usage.  Matlab is reasonably good at this task when creating binaries, also can be used to optimize code for intrinsically parallel computing problems on parallel systems such as computing clusters or using GPU based platforms such as the NVIDIA Tesla.  All of  this done can be done without additional effort on the part of the programmer.  At somewhat lower levels of hardware abstraction, such as Fortran (yes, scientists still commonly program in modern versions of Fortran)  compilers have implemented extensive and painless code optimization  features.

My advice is this:  Learn to code in C, assembly language or similar low level language if you need it to accomplish the tasks you need to accomplish.  If you want to work on OS kernel development, by all means learn C.  For higher level tasks, I'd argue there are far better tools available that are aimed at solving problems and accomplishing tasks.  Pick the tool that suits the need.  Personally, I think C is a nasty little language that if not specifically required for a project should be generally avoided by the non-professional programmer (i.e. not software developer).

One point to learn and learn well.  Programming is mainly about two things:  Algorithms and data structures.  These are inherently independent of the particular language used for purposes of coding and the supporting hardware--they are conceptual.  If you do not have a clear concept of the problem and the desired functionality of the program, you will fail.  Learn this aspect of programming well regardless of the language you select.

There are basic conventions and structures that should be followed carefully when coding. Most current languages impose some degree of structure by design (e.g. Pascal, Modula, Forth) but most do not.  It was a serious problem in earlier versions of many languages that allowed horribly unstructured code, often with complex manually constructed looping and "goto" structures to make the code convoluted, prone to errors and maddening to debug.  Modern structured programming approaches eliminate all of this.  Finally, learn to properly comment code inline.   A small effort here prevents a thousand headaches later.
Title: Re: Learning the C programming language
Post by: Roll on October 15, 2017, 03:55:45 PM
Quote from: AnneK on October 15, 2017, 11:38:23 AM
Coursera used to be free.  I took a few courses, including Python.

If anyone is looking for free and Coursera is no longer, Udacity has a few free programming courses including an Intro to CS one dealing with Python.
Title: Re: Learning the C programming language
Post by: Chloe on January 01, 2018, 05:27:14 AM
Quote from: Roll on October 15, 2017, 03:55:45 PM
If anyone is looking for free and Coursera is no longer, Udacity has a few free programming courses including an Intro to CS one dealing with Python.

Roll, Coursera is still free (thx Bari Jo), can 'audit' a class for no certificate credit. Am struggling with 'Machine Learning' with instructor Andrew Ng of Stanford they are using 'Octave', a very concise Matrices and Vector processor. My grasp of linear algebra notation leaves some to be desired!!

p.s. I know my way around Atlanta pretty well . . . SW of airport Newnan area is prolly most friendly, affordable place to be. Know good therapists and endos to use haven't been to 'group' lately but can definitely steer ya in right direction.