C Programming: What's Next After Learning C?

  • Thread starter Drakkith
  • Start date
  • Featured
In summary: If you can't code in one language, though, you probably can't code in any.This is true, but I also think that you can still learn a lot of useful things even if you can't code in a particular language. For example, I think that I've learned a lot about programming by reading code and trying to understand how it works and how to make it do what I want.
  • #36
This thread is going everywhere. To your disadvantage, IMO.

Bottom line - as some folks politely pointed out:
1. You have been exposed to C. That does not mean you can program well - undefined behavior comes to mind here.

Great advice! :
2. Do not go learning the syntax of another language - especially just because people here like it.

Follow the advice already given multiple times:
3. Find something to build your skill set. If nothing else learn some algorithms expressed in C:
Try: http://rosettacode.org/wiki/Category:C -- several hundred algorithms. Good algorithms are absolutely key. Period. Some on the page may be over-simplified
 
  • Like
Likes phinds and Drakkith
Technology news on Phys.org
  • #37
So it seems this thread has run its course.

However by popular demand it is now open for more ideas for Drak.
 
Last edited:
  • Like
Likes Drakkith and jim mcnamara
  • #38
Depending on how much you like puzzles there are challenges like those listed on projecteuler.net
One thing you will learn (this is my view on the matter) from that is how to work with big numbers and how to use maths to avoid overhead.

I don't really know the quality of the challenges at hackerrank.com but I see promising sections like data structures.
It contains linked lists, trees, sparse arrays, ...

Sparse arrays are a nice thing to think about. Suppose you have huge arrays representing a grid. Most of the entries are zero.
How would you save such an array? (there are a lot of ways)

Ultimately I would say you just need to find something that's interesting to you.

One final note, when I was doing a course on Monte Carlo simulations I found it incredibly useful to integrate GNUplot in my code.
This way I got the plot immediately. I'm not sure how easy this is on windows but on linux it took but a few lines (it also helped to understand pipes a little better).

Another thing I implemented back then were named arguments i.e.

Code:
./Simulation -s 10000 -N 500

Here the "s" argument would signify the number of steps (typically a lot more) and "N" the number of particles.
The big advantage of this approach is that you don't have to remember a specific order for the parameters.
With a "help" option it becomes even easier.
 
  • Like
Likes Drakkith
  • #39
After a basic course in C and provided that you like this language, my recommendation is:

- Learn about algorithms and data structures. This is the real "working engine" for any program. I highly recommend Robert Sedgewick's "Algorithms in C".

- Learn about C libraries (Standard and many others contributed) and become well acquainted with pointers and memory allocation concepts. If you can't make your machine throw up, you have not learned enough C.

- Learn to use even the modest tool to do your job. Back when I learned C, we were forced by the professor to use various simple editors, so to focus on language and not on IDE's - what existed back then anyway, bells and whistles. Now, it is an absolute necessity to use some decent IDE to do your job but if you know C (or any language for that matter), it is just a matter of getting used to.

- Try to make a whole world ticking through the command line first. Full blown applications with candy GUIs, come second.

- Choose between going "low" or "high". I'm not particularly exposed to low level programming but I think that going "high" gives much more opportunities to get decent programming skills, taking into account the bunch of languages you can migrate to and the bunch of kinds of applications you can develop.

- If you want to take a really big dive into C world, then get into the inner world of some Linux distro (you name it), however "deep" in the system you like.

- Get into the C++ world as well, for an overdose of hard times in programming which will pay millions in programming experience.

I did not say anything new, most of these have more or less already been mentioned in the thread, but this is my opinion, based solely on my own programming experience. In short, don't just use C for scientific purposes: go for being a top - notch programmer too!
 
Last edited:
  • Like
Likes Drakkith
  • #40
Drakkith said:
Any suggestions for a guy with no money?
A friend of mine has written a system to predict the English Premier League football scores. Albeit with limited success.

If you could do better, you could perhaps make some money from the unsuspecting bookmakers.
 
  • #41
Checkout Rosettacode.org and see if you can implement any of the examples better and learn how others solved the same problem.
 
Last edited:
  • #43
I was teaching "Programming 101" and my last lecture/task to students before exams used to be to write a N-body gravity simulator. It's not too hard, and let's them see how they created something rather cool.
 
  • Like
Likes Drakkith
  • #44
Thanks to everyone for their suggestions. Even if I haven't quoted or liked your post, I assure you that it's been very helpful!
 
  • Like
Likes jedishrfu and Dr. Courtney
  • #45
Drakkith said:
So I'm about to be done with my first class in programming where we learned C programming. Unfortunately, I don't actually know what you can do with it. All of our programs in my class have involved us programming and running everything using Visual Studios, not developing standalone executables or something. The only way we've had our programs interact with the 'outside world' is through the keyboard and screen or through text files.

To be honest I feel like I've been trained to use a lot of specialized tools but don't have any use for them. Perhaps like a carpenter with no wood and no work.

Thanks.

Given your interest, I suggest looking into the world of embedded systems. It's a huge part of the computing world. You can control an external device using a microcontroller which you can program in C. For example, you can control a robot arm. This is just one example. Think about scientific instrumentation. Medical devices is another example. Pacemakers for example. How about drones? You get the idea.

There is no need to learn numerous programming languages in order to do something useful. Lots of people make a living programming embedded systems in C or maybe C++ with perhaps a bit of assembly language as well. I would think about that and also about learning more about algorithms and data structures.
 
Last edited by a moderator:
  • Like
Likes OmCheeto and Drakkith
  • #46
According to me C programming is the basic of all programming languages. Once you have learned C programming, you will be very comfortable with other languages to learn. You must try to learn Java programming.
 
  • #47
Juanita Smith said:
According to me C programming is the basic of all programming languages. Once you have learned C programming, you will be very comfortable with other languages to learn.
While I agree w/ you, I have come to learn that that is JUST an opinion and not everyone agrees.
You must try to learn Java programming.
Why? I've been programming in various languages for 50+ years and have never bothered with Java. Why should the OP?

Besides, the OP is a bit slow and Java might be too hard for him :-p
 
  • Like
Likes OmCheeto
  • #48
phinds said:
Besides, the OP is a bit slow and Java might be too hard for him :-p

Well, looks like someone isn't getting their Christmas present this year...
 
  • Like
Likes phinds
  • #49
C is about as close as possible to writing directly in machine code without actually doing so, a compiler is used instead.
Every hardware system understands some implementation of C, higher level languages not so much.
Sometimes higher level languages generate C code, and that is what finally gets compiled as an executable program
 
Last edited:
  • #50
rootone said:
C is about as close as possible to writing directly in machine code without actually doing so, a compiler is used instead.
Every hardware system understands some implementation of C, higher level languages not so much.
Sometimes higher level languages generate C code, and that is what finally gets compiled as an executable program
I disagree. ASSEMBLY language is as close as possible to writing machine code without actually doing so. That in fact is why assembly code was invented. We got tired of remembering all those zeros and ones.
 
  • Like
Likes OmCheeto and Mark44
  • #51
True, I meant to say assembly language for whatever system it is.
Pure machine code is all 0/1 and might not even be written on a keyboard but might be input by physically toggling dozens of individual switches.
Does anyone anywhere actually do that these days?
 
Last edited:
  • #52
Drakkith said:
So I'm about to be done with my first class in programming where we learned C programming. Unfortunately, I don't actually know what you can do with it. . . . I don't really have any specific applications that I'm thinking of.

Nidum said:
Real world applications programming is a thousand times more challenging and more interesting than just shuffling fictional data sets around and doing pointless graphics .

I agree with Nidum above.

Beyond that, speaking as someone who many years back did a lot of script-based programming to aid with my work as a technical writer documenting software; as well as many automation routines just for my own enjoyment at home; who used to interview a lot of programmers; and who taught himself the rudiments of C for the fun of it; and did other DIY projects like write an entire shared editing website (back before shared editing became commonplace) for a team of writers on a book project, completely in objects in Python; but who doesn't program at all these days - to me, the disconnect you are experiencing seems directly related to not having any applications in mind, nor perhaps any interest quite yet in programming as a culture (e.g. how language design relates to purpose, for example, as Paul Graham once wrote about).

Which I admit surprises me. I would have thought that in a school setting, your profs would have laid out a general path or out-branching paths in terms of why and how to learn programming. And likewise I would have thought it a natural inclination to come up with some candidate applications that either interest you personally, or seem possibly relevant to your potential career path or paths; and then to take it from there. But perhaps this opening course in C was taught the way my freshman year English lit classes were taught long ago - by rote, very distanced, not much guidance?

Anyway C is just one language - very far from a stopping point or even necessarily something you need to get good at right away; the point is that having learned a little bit about C, learning your next language ought to be easier. Play with C if you think you'd enjoy it; otherwise I'd suggest getting on with finding applications. You can do that by learning one or two more languages; this makes it more likely that at some point you will experience serendipity, i.e. learn about potential applications which are interesting and/or useful to you. Hardcore programmers used to be obsessed in maximizing efficiency with really frugal algorithms and I imagine there must still be some of that aspect today in some areas, in other words really geeky math-driven approaches; meanwhile, cheap fast hardware long ago opened up scripting. All in all programming always seemed more like play than work; so you could think in terms of playing around, experimenting.
- - -

P.S. Back when I was still doing freelance editing, I edited a textbook on programming for biologists - Python for scripting, various tools available in the Linux shell, and Arduino for field data: Practical Computing for Biologists, Haddock and Dunn. It's not anything to do with physics, but but a glance at the table of contents via https://www.amazon.com/dp/0878933913/?tag=pfamazon01-20 does demonstrate that a programming language by itself is just a small part of what computing in science is about. If you're a carpenter, you're going to want more than a single hammer to build something with.
 
Last edited by a moderator:
  • Like
Likes Drakkith
  • #53
rootone said:
True, I meant to say assembly language for whatever system it is.
Pure machine code is all 0/1 and might not even be written on a keyboard but might be input by physically toggling dozens of individual switches.
Does anyone anywhere actually do that these days?
I doubt anyone does now but I did it when I was starting out.
 
  • #54
phinds said:
I doubt anyone does now but I did it when I was starting out.
Me too when i got my first micro, MITS Altair 680 with the motorola 6800. The computer had a bank of toggle switches for addressing and data and it took forever to enter a program didnt work. I tried to light up the leds with a pattern but it just didnt do anything.

http://www.vintage-computer.com/mitsaltair680b.shtml

I was tempted to buy a televideo mterminal and use the onboard tty monitor program via rs232 but it was not cost effective at $700 for the televideo. I eventually went with the trs80 from radio shack.

http://www.vintage-computer.com/trs80mod1.shtml

In hind sight the MOS KIM 1 6500 system board was a better deal but i was out of money by then. Programming for it was in hexidecimal

http://www.vintage-computer.com/kim1.shtml
 
  • Like
Likes OmCheeto
  • #55
UsableThought said:
I would have thought that in a school setting, your profs would have laid out a general path or out-branching paths in terms of why and how to learn programming.

Lord, no. I only took the class because I needed "programming experience" before taking a Digital Logic class later on. There was absolutely no information given to us about branching out or anything else like that.
 
  • Like
Likes OmCheeto
  • #56
Drakkith said:
...There was absolutely no information given to us about branching out or anything else like that.

I can see now, that you are on the path, young Drakkths.

Acknowledging the landing of the flock of impending black swans, is a sure sign, that you are on the path, to... the dark side...

Code is your father...
 
  • Like
Likes Drakkith
  • #57
Drakkith said:
So I'm about to be done with my first class in programming where we learned C programming. Unfortunately, I don't actually know what you can do with it. All of our programs in my class have involved us programming and running everything using Visual Studios, not developing standalone executables or something. The only way we've had our programs interact with the 'outside world' is through the keyboard and screen or through text files.

To be honest I feel like I've been trained to use a lot of specialized tools but don't have any use for them. Perhaps like a carpenter with no wood and no work.

I've also considered learning something like C# and I'm just curious as to what the differences are in what you can develop with each one, if there are any differences of course. I know that C# is a much higher language than C, but the extent of my knowledge mostly ends there. If I'm not looking to develop blazing-fast programs for huge amounts of calculations, is C# a good choice? I don't really have an specific applications that I'm thinking of.

Thanks.

In C# you can create any application of software which is GUI based easily
 
  • Like
Likes Drakkith
  • #58
jedishrfu said:
Me too when i got my first micro, MITS Altair 680 with the motorola 6800. The computer had a bank of toggle switches for addressing and data and it took forever to enter a program didnt work.
Did it take more time or less time to enter a program that did work? :oldbiggrin:
 
  • Like
Likes jedishrfu and Drakkith
  • #59
Mark44 said:
Did it take more time or less time to enter a program that did work? :oldbiggrin:
Oh, entering the ones that actually WORKED took WAY longer :smile:
 
  • #60
phinds said:
Oh, entering the ones that actually WORKED took WAY longer :smile:
Isn't that the truth?

In your upcoming Insights article, you mentioned some of the early programming languages, one of them being PL/1. The first programming class I took was in 1972, with the language used being PL/C. The C in the name indicated that it was a compact subset of PL/1.

Although we didn't have to set switches on a console, writing code seemed just as arcane. We used a keypunch machine to make the IBM (or Hollerith) cards, added a few Job Control Langauge (JCL) cards at the front and back of our card decks, and submitted them. The computer operator would run the cards through a reader, which would transcribe the code onto a tape reel that was subsequently mounted on the actual computer. The results came back several hours later, or even the next day. Most of my early programs produced no recognizable output -- just many pages of what looked like gibberish to me (a core dump of the computer's memory). Ahh! The good old days!
 
  • Like
Likes jedishrfu, Borg and QuantumQuest
  • #61
Mark44 said:
Isn't that the truth?

In your upcoming Insights article, you mentioned some of the early programming languages, one of them being PL/1. The first programming class I took was in 1972, with the language used being PL/C. The C in the name indicated that it was a compact subset of PL/1.

Although we didn't have to set switches on a console, writing code seemed just as arcane. We used a keypunch machine to make the IBM (or Hollerith) cards, added a few Job Control Langauge (JCL) cards at the front and back of our card decks, and submitted them. The computer operator would run the cards through a reader, which would transcribe the code onto a tape reel that was subsequently mounted on the actual computer. The results came back several hours later, or even the next day. Most of my early programs produced no recognizable output -- just many pages of what looked like gibberish to me (a core dump of the computer's memory). Ahh! The good old days!
Yeah, I remember them well. In addition to the old punch-card-overnight-submisison circus using Algol and later Fortran, I later ran minicomputers where you had to load an editor from punched paper tape, load your souce code into the editor, do your edit, output a new source code tape, load the assembler (there WAS no compiler on the first one I worked on), load the source code tape into the assembler, produce an output object code tape, load the object code tape and then run the program. I think I may have left out a few steps. It took most of a day to do a single program turn-around. What fun.
 
  • Like
Likes QuantumQuest
  • #62
Mark44 said:
Did it take more time or less time to enter a program that did work? :oldbiggrin:
The working ones took forever and a day and now presenting Mary Hopkins singing Those Were the Days:

 
  • Like
Likes QuantumQuest and Nidum
  • #63
I recall working on a character based plotting program which I got working kind of but it didn't work the way I expected the line plot was there in the output but everywhere I expected a space was a zero. It didn't dawn on me until much later to initialize the array of characters with spaces.

I would get two or three chances a week on Friday nights at our Explorer Post 635 meeting to fix the program hoping each time that it would work but to no avail. Finally one of my mentors mentioned the initialization solution.

I never got back to programming until I graduated from college and was snapped up by the company that sponsored the post. I was the first to return (poster boy for the success of the sponsorship) and they thought I had the best potential to succeed, boy were they wrong I mean right I mean...
 
  • #64
Anyone remember text based 'dungeon master' ?
The progenitor of nearly all games in existence today.
Unless you wanted impressive graphics, in which case 'pong' would have been the thing.
 
  • #66
I used Assembly language and C for developing firmware for Intel Micro Controllers years ago when I was designing controller boards. C# is not a bad language. It has direct file access capabilities but I still prefer C for certain tasks
 
  • #67
Vanadium 50 said:
There are a number of schools where a CS degree involves learning a bunch of languages, but not anything in data structures, algorithms, numerical methods, etc. I don't much care for these programs. Someone who knows one language well and knows how to program can figure out other languages if needed. If you can't code in one language, though, you probably can't code in any. Google "Fizzbuzz" for rants about this.

If you mean four-year university programs, then this is a rather shocking revelation. The essence of computer science, IMHO, is the study of data structures and algorithms. How can any four-year CS program get away with this? But if you mean shorter programs, designed to provide a credential in one or more programming languages, then perhaps they want to teach the core CS topics in the context of learning a programming language?
 
  • Like
Likes jedishrfu
  • #68
I've had a love/hate relationship with several programming languages. After several years of professional programming, I have finally settled on only two: C and assembly language. The latter is of course only for special situations where it's truly needed. Although I must admit I will always admire the original Roller Coaster Tycoon, not only because it's an excellent game, but because it was written entirely in assembly. Keep in mind, I no longer have anything to do with web programming, so I don't need to think about that zone of madness.

Once I was very enthusiastic about C++, until I realized that after luring me into its web with certain promises, it turned out to be a baroque nightmare. As for other languages, let's just say that aside from Pascal they have all left me with bad memories. Perhaps in a perfect world, as designed by the finest Swiss craftsmanship, we would all be programming on Oberon systems. But that's not real life.

My most traumatic love/hate affair has been with LISP. But I must forget that in order to move on with my life.

I've found that by limiting myself to C, I don't need to spend any time on learning language features, or worrying about whether there is a "better" language out there somewhere.

Of course I still need to wrestle with the so-called "Windows." The nightmare never ends. Sometimes I long for an extended DOS.
 
  • Like
Likes jedishrfu
  • #69
Yeah I've had similar experiences. I programmed the traditional four: verbose Cobol, fragile Fortran, majestically awesome Macro Assembler. After reading KR, i started learning concise C and when CFRONT came out a few years later, I started to learn complicated C++ and the STL which was somewhat painful.

I was glad to jump to Java with its single inheritance model and its run everywhere feature but disliked the infinite number of classes and methods and overloading which has since been tamed with the IDE tools like Netbeans and Eclipse.

I continually search for the perfect language like Diogenes of old, but have yet to find it. I do gravitate to scripting languages for prototyping ideas. My first goto language was amazing awk and when the idea outgrows awk, i switch to perennial python then on to groovy Groovy to leverage some java capability.

Ive dabbled in superformal Scala and cute Clojure but the learning curves were a bit much with little to spend. Also Scala tended to break compatibility with each new major release even though its very powerful and still developing. My coworker had sent me an article on folks at startups who abandoned Scala for Clojure. Clojure is basically LISP on Java with extras to seamlessly work with Java and run everywhere Java can.

My current ventures have been with nodejs and javascript which has really surprised me in its expressiveness. I've used it to do web apps without the complexity and builtin restrictions of tomcat or jetty mostly with restricted access to dynamically generated files.

I've been looking at Elm and its promise of functional reactive programming and its possible successorship to Javascript. Elm actually compiles to Javascript. Note its time traveling debugger feature where you can replay your sequence of interactions while tweaking the code live. I also like the functional programming aspect of Elm as it makes code far easier to debug since you trace where data came from and where its going.

Julia is another interesting functional programming language with method overloading but without the OO aspect. Its a potential open source successor to matlab. The ijulia notebook is an interesting way to develop or teach coding. Its a webpage input editor and a program output display that's great for setting up a lesson and walking through various snippets running each as you go along.

My favorites are Basic and Fortran for their simplicity and because they were the first ones i wrote games in.

Next came TEX a cool Honeywell 6000 scripting language built on top of the timesharing line editor. It was like Awk and Lisp merged where code could write code and then execute what it wrote. There's a wikipedia article that I once wrote on TEX aka Text Executive programming language if you want to know more about it.

Next comes C and Awk with Awk being a kind scripting version of C without structs and unions. Awk rejuvenated my interest in programming years ago after I found a version that ran on DOS. I added ansi codes to my programs for character based color loaded screens.

Next comes Rexx and Python two fairly syntax free languages that were quite expressive. Rexx had a feature that default values for variable were their names instead if the now more popular null. Rexx also had dot notation to make a variable have attributes with values too.

I also liked Prolog and Forth for their unique programming paradigms. Forth was like a reverse polish notation of Lisp without parentheses and Prolog's goal directed paradigm was a challenge to master. Somestimes its good to break out of the procedural OO way of thinking.

And the search continues...
 
  • Like
Likes Aufbauwerk 2045 and QuantumQuest
  • #70
"If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual
private destructor, and when was the last time you needed one?"

From van der Linden, Expert C Programming.

For those who have not read it, here is the famous anti-C++ rant by Linus Torvalds.

https://lwn.net/Articles/249460/

I would put it differently. C and assembly language is enough. Apply Occam's razor. The time I spent learning C++ and other languages could have been better spent developing tools in C. Now I'm a born-again C programmer and the universe is my oyster.
 
  • Like
Likes FactChecker and jedishrfu

Similar threads

Back
Top