Should I learn C before I start with golang?

(pmu) #1

I am a storage guy trying to learn a new language. I am also trying to learn AWS. Found that AWS has go SDK so thought I will try my hand at Go. This way I can learn AWS and an automation language simultaneously.

My background:- I have done some Perl scripting in the past. I also know a bit of Python and very little C.

My dilemma: It appears that Go is for those who are extremely proficient in at least 1 language (C/C++/Java). To me, Go appears a lot like C but like I stated earlier, I know very very little C.

Should I learn C and then learn Go?
Please advice.

(Johan Dahl) #2


I think learning C is much harder than learning go. C is a small language but pointer arithmetics and manual memory management can be a bit hard in the beginning. So my recommendation would be to start with go and if you need to learn C later. But this is just my opinion. I think go hits a sweet point between easy to learn and write and great performance. Python is easy write but programs are usually slower, C can be really fast but harder to get right.

(Jay Ts) #3

For a Go programmer, it can be very helpful to already know C because then you can use the cgo package to fall back to C when you need more direct connection with the operating system. But then you may be writing non-portable code, so it’s best to avoid cgo if possible.

If you learn C first and then learn Go, you will find Go much easier, as Johan said. But you will still have to learn things that are in Go and not in C, and you will need to adjust your thinking to almost always prefer to use slices rather than arrays, for example.

I learned C in the early 1980s, and as a result, learning Go was easy for me. But if your objective is to learn Go, then I have to say that making yourself learn C first really isn’t worth it.

BTW, I don’t agree that Go is only for people who are “extremely proficient” with C/C++/Java or the like. There are people on the forum who are learning it as a first programming language, or with backgrounds in just Python or some other interpreted language.

I think the thing that’s missing is a good comprehensive book to teach Go starting at a beginning to intermediate level. There are few books (and online resources) for beginners, and they usually don’t cover the full language. And there are books that start at an intermediate to advanced level that go into detail. So it’s easy to get the impression that Go is for advanced programmers only.

Really, I’ve found Go a lot simpler and easier for beginners than C was for me. Maybe that is all I needed to say!

(Eric Lindblad) #4

As far as a first coding language to learn, at Tohoku University they have begun teaching Haskell to a very small group of first-year undergraduates (some are with no programming experience), where they seem to pick it up.

As you mentioned Perl here is the name of a book of which the Preface is interesting to read.

Earlier comment here: Go is recommended as the first programming language?

(pmu) #5

Hi All,
Thank you for the reply. I did do a quick review of C. I had forgotten the switch statement. So I think I am now ready to start learning Go.
Thank you all once again for your reply.

(Johan Dahl) #6

Look forward to all you’re going to learn. It is an interesting journey in front of you.

(Eric Lindblad) #7

I’ll add a link here to LtU.

(Johan Dahl) #8

Really nice article

(Inanc Gumus) #9

You don’t need to learn C to learn Go. Go is very simple but it’s very subtle. It’s easy to learn but not easy to master.

For example, here, I’m teaching to every level of people: Go: The Complete Bootcamp Course.

(pmu) #10

Thanks for the link. Just that I have already enrolled for another Go Course on Udemy by Kam Hojati about a week after posting question here. If I had seen your comment earlier, I would have sure gone for your course.

(Inanc Gumus) #11

It’s not a problem at all :slight_smile: Check out the free preview videos, you can easily see the difference.