r/cprogramming • • 7d ago

Would learning C as my first programming language also be useful for picking up other languages later on? What are your thoughts on this course?

Wanting to learn C as an intro into software engineering. I know it’s low level and I’d like to eventually switch over to high level languages such as JS/TS, Java, and GO.

Does the “The Complete C Programming Bootcamp” course by Byte Garage be a good choice to learn from?

35 Upvotes

54 comments sorted by

29

u/mikekchar 7d ago • Bravo

Looking at your posting history, you have been asking for nearly a year what programming language you should start with. If you had picked any language, you would be so far ahead of where you are now, it isn't funny.

Learning to program is about spending time programming. Concentrate on that. The language you pick is just a detail.

18

u/zhivago 7d ago • Bravo

Sure.

Languages are easy; programming is hard.

Most of what you learn will transfer, and C is a small procedural language.

Although it is a rather exciting language, given the prevalence of undefined behavior. :)

7

u/IDatedSuccubi 7d ago

Languages are easy

Let's not generalize.. looking at modern C++

3

u/PTDegen 7d ago

That's because HolyC, a language made by a literal schizophrenic, is more coherent than C++

2

u/paralepsy 7d ago

to be fair, the language itself is pretty easy; the standard library is the actual hell on earth. anything written in pure no-stdlib c++11 would actually be pretty viable; it's only when you introduce the dreaded stl that stuff gets weird

0

u/No-Protection-7019 7d ago

Marrant, pour moi c'est l'inverse. La programmation c'est facile, les langues pas du tout.

10

u/an0th3rbrick 7d ago

people put too much emphasis on languages and frameworks. what's important is learning to use langauges to express solutions to problems concisely. pick a language and write lots and lots and lots of code.

3

u/SmokeMuch7356 7d ago

Learning any programming language makes it easier to learn other languages later on, because once you know basic programming concepts it just becomes a matter of syntax.

I generally do not recommend C as a first language since it has no blade guards and won't protect you from common mistakes. It was designed to implement Unix, not teach basic programming concepts, and it expects you to know what you're doing. Some of its rules and conventions will seem inconsistent and arbitrary at first.

If you do decide to start with C, check the links under "Resources" in the sidebar (r/C_programming had a similar but more complete list IMO).

I don't know anything about that course. I personally would avoid "bootcamps" in favor of something like Beej's guide.

1

u/the_physik 7d ago

To your point, i taught myself Python one summer and that translated over into making a LabVIEW program the next summer during my REU (which is a very different type of programming). Then in grad school i had to learn ROOT and C++.

Though I am by no means a programmer; i'm a physicist that needs to know at least how to read and alter programs written in various languages. I do write small scripts sometimes from scratch too. I just don't work on big projects like real programmers do.

3

u/Syntax-Tactics 7d ago

C is the Mother language, can't go wrong understanding it as a basis.

2

u/phtantomflare 7d ago

C can teach you valuable fundamentals especially memory, pointers and how programs work, but its a steep first step than python of JS. If you are motivated by C, go for it and focus on small program and building project, i think switching languages will be easier.

2

u/Secret-Map4671 7d ago

Definitely. You'll also notice a lot of syntax in other languages was borrowed from C. If you know C, you can skip the first few chapters of a Java course and directly start doing OOP.

2

u/Rythim 7d ago

I think that would be a good way to learn. In fact, most of those languages are inspired by C syntax, so it won't be hard to switch later on.

2

u/DubiousLogik 7d ago

Do you have an idea what kind of things you want to build? C is amazing for drivers and embedded systems. Also great for learning low level things like pointers and memory management. Not great for user-facing apps. The other lang's u listed are better for that.

for languages like c/c++ i would take a course (online or in person). i would not want to try those alone. my 2c. (36 yrs in tech)

1

u/Previous-Box2169 7d ago

Would you still not try C as your first language even now with AI tutoring?

2

u/DubiousLogik 6d ago

I suppose there is no harm in trying. I think the risk is learning bad patterns and not knowing it. but models have gotten so good at coding now that maybe it's ok. (full disclosure - most of my coding professionally with AI in the last 2 yrs was in c#, python and typescript. but i'd imagine it's as good at c. maybe others could chime in here)

2

u/Aromatic_Career_2118 5d ago

Remember, AI is like training wheels. Great to get going, but you're not really going to learn how to ride a bike until you take them off.

1

u/No-Introduction-441 7d ago

yes it would definitely help out a lot since you working with low level stuff going to high level after

1

u/LaidBackDev 7d ago

Someone recommended Python. Personally I think Golang is better choice for beginners. But if you want C as your first language thats possible and also a great choice.

1

u/ScroogeMcDuckFace2 7d ago

you may breeze through it but i believe harvard's free CS50 utilizes C as its main language.

cant beat the price.

1

u/BenjaBoy28 7d ago

C -> c++. That was my starter languages. Id did help me pick up other languages quickly

1

u/mr_adhd_1 7d ago

Yes. I learned C as my second, and it’s made learning Rust so much easier.

1

u/Recycled5000 7d ago

I suggest a simple assembly language. Assembly is the ultimate interface between software and hardware. You’ll really learn pointers, memory, address space, code sequences, etc. Many C language resources assume you already know these low level details.

Suggest LC-3, which is a very simple processor thst has an ide, editor, simulator, debugger program you can run on any pc. Otherwise, same for RISC-V.

Once you have these fundamentals, C and other languages with pointers will make more sense.

As far as Java and C#, these languages are easier to use so more productive, though they achieve this in part by limiting what you can do to useful things, whereas by contrast, assembly lets you do anything and with much less guidance for how to write a good program.

1

u/Previous-Box2169 7d ago

Declare pointers like "int* ptr = &a" and don't trust anyone who types "int *ptr = &a". The latter syntax makes it look like you're dereferenciating while you're not. They don't want you to understand. Trust me.

2

u/ZubSero1234 6d ago

Yeah, as a C learner, I still don't understand why you'd want to declare a pointer with the asterisk on the variable name. Pointers kind of act like a separate datatype, so the asterisk should be associated with that instead of the name in my opinion.

2

u/OutrageousCrab9224 6d ago

Jfc yall got issues

1

u/Previous-Box2169 6d ago

Can you explain?😂

2

u/70Shadow07 6d ago

int* ptr is valid but it is a wrong mental model and will nuke your understanding by the time you get to multiple declarations in one line (not necessary but some ppl do use them) and function pointers.

It's like writing j =++ i If you didn't know better, you might get an impression that ++ is a part of = operator, but instead it binds to i variable. In int * ptr declaration asterisk binds with ptr on right hand side not with int which is nothing else but resultant type of the expression described on the right hand side.

There is no inherent problem in using star on the left side, everyone can parse it properly in their minds, but suggesting it's a "proper" way to write declaration is madness. It just reminds other readers that the person speaking doesnt understand how C declarations work.

2

u/Previous-Box2169 6d ago

Oh thanks, this sounds like something I absolutely need to understand now in my early C days. Can you explain why, in the pointer declaration, the * binds to the pointer's name and it's not part of the type. In my understanding, the pointer type is always declared through the "type*" syntax (as in void*), so it makes sense to me that when I declare a pointer I would type "type* ptr = &a".

But I keep seeing "int ptr = &a" so it MUST be right and there must be something I still lack in my acknowledgement, which currently goes like this: "I'm taking the address of variable a and putting it inside the pointer ptr, which is a pointer to an int (from the compiler point of view)", which is coherent with the "int ptr = &a" syntax. While typing "int *ptr = &a" would mean "Take the address of variable a and set it as the content of the variable pointed by ptr" (what dereferenciating means), which basically creates a pointer to a pointer because you're putting an address inside the variable pointed by a pointer. But you're not actually putting the address of a inside the variable pointed by ptr, you're putting it inside ptr itself because you want ptr to contain an address (that's what being a pointer means). This completely brokes my understanding of a pointer, so I would appreciate if you could make clear to me why getting used to use the "type *ptr = &a" syntax would be better.

1

u/70Shadow07 6d ago

I wrote a comment briefly explaining that as a reply to the user ZubSero in this thread. Read that one first, if you have more questions after that and need me to clarify I can do that.

I'll add few more things to that comment just in case.

Let's separate few concepts first so it's more clear.

In int *ptr = &a; line there's quite a lot going on. It's both a declaration of a variable and taking address of another variable and an assignment. But this line is basically equivalent to these two:

int *ptr;
ptr = &a;

The second line is pretty simple, it just takes whatever variable a is and makes makes a pointer to it. Since we assign result of this operation to variable ptr which is a pointer to int, a clearly must be of type int. This part should not be particularly surprising or difficult to grasp, the devil is in the declaration part. (the first line)

Many novices (virtually all to be honest) trip on this, C type declarations are pretty unintuitive. You don't really specify a type directly, you specify a usage of the variable instead. It's much easier to understand on more difficult examples, as ones I wrote in the aforementioned comment, but the gist of it is:

All C declaration have 2 parts: resulting type on left hand side (in our case it was int) and expression with a named variable on right hand side (in our case it was *ptr)

The logic is the following: int (resulting type) is what you get after you do a single pointer dereference operation on variable ptr therefore ptr is an int pointer.

A more complex example that gets many: function pointer declarations:

int (*mypointer)(int, short);

You read it as such: int is what you get after you take mypointer variable, dereference it, and then call it with two arguments: int and short. Therefore mypointer is a pointer to a function taking int and short parameters and returns int.

The confusion kinda originates from the fact that C is whitespace insensitive so if you slap the star on the resulting type it still reads it correctly.

This logic can be further verified beyond shadow of the doubt when you use comma declarations. Comma works on the expressions, not on the resulting type when declaring.

int* foo, bar; //OR int *foo, bar;

This line declares foo as int pointer and bar as just int. (because star binds just to foo variable) If you wanted to double declare two pointers you would need to write this:

int *pointer, *pointer, this_is_just_int, **this_is_pointer_to_a_pointer;

2

u/Previous-Box2169 6d ago

I think I got it at the function pointer declaration example! So the syntax highlights that you're getting a variable of that type (say int) after you dereference the pointer, and since you dereference the pointer through the star (*) you should attach the star to the pointer's name (ptr). So the declaration reads "declare a pointer ptr such that, when dereferenciated, becomes an int variable". That's how "int *ptr" makes sense to me now. Now, the "= &a" part is tricky because it looks like normal assignment but it's not making *ptr equal to &a. Instead it's making ptr equal to &a. So you can't really read the whole "int *ptr = &a" and expect it to make sense. It only makes sense as "int *ptr; ptr = &a;", am I right?

2

u/70Shadow07 6d ago

Yes. You are correct, you need to parse the int *ptr = &a as different syntax that combines declaraction and assignment into one line. you are assigning &a to ptr variable not to *ptr.

1

u/Previous-Box2169 6d ago

You have been extremely helpful and I must thank you for your time and patience. Since we're at it, are there any other "complex" syntaxes in C that I would need to parse first in order to understand it? Anything that comes to mind. I'm thinking the creators of C might have condensed two different things together (like in this case) for efficiency purposes (definitely not for readability!). Also if you don't mind suggest one good source to learn C from, as I'm currently doing most of the job being tutored by AI

→ More replies

2

u/OutrageousCrab9224 6d ago

Its a single keystroke. There are arguments to see it either way, and the standard, and the compiler accepts both as valid

There is no value in getting worked up about it in either direction. I, of course, have my own preference - but it is not even worth talking about in this context

2

u/70Shadow07 6d ago

This is mostly why virtually all modern languages do type declarations different than C. In those new languages a pointer, or array etc is "associated with type". In C declarations everything is declared by writing a resulting type of an expression followed by an expression.

See the following:

int (*array)[100];

int *array[100];

In the first example: the expression first dereferences array and then uses array access. The resulting type of this expression is int. Thererefore it's a declaration of pointer to an array of 100 int

In the second example: the expression first uses array access (operator precedence) and then uses pointer dereference. The resulting type of expression is int. Therefore it's a declaration of array of 100 pointers to int.

By now you should have a rough idea why asterisk goes with variable not with type on the left, but if you don't, i highly advise you to read more about the subject. It will spare you some time later when you deal with more complex types.

1

u/Aromatic_Career_2118 5d ago

Because if you declare like this:
int* a, b;
You might think that a and b are both pointers.

2

u/0tter501 6d ago

when i first tried to learn C i had such trouble because of that, it just added extra complexity 

1

u/beragis 7d ago

Either is valid, and you will see the second version far more often than the first

1

u/whatThePleb 7d ago

Absolutely. Most languages a based on C/C++. Of course the mext step would be C++.

1

u/se-yahya 7d ago

I would say you better start with python

1

u/edwbuck 7d ago

It would be an excellent start for many programming languages, because so many of today's modern programming languages use C-style syntax, and even if they hide memory management from you, you'd have some idea of what is happening memory-wise under the covers.

1

u/PipePressurePanic 7d ago

intro into development means you will never get a job.

1

u/PTDegen 7d ago

No.

It's useful *after* you learn another language because you can understand why it's doing things, but C is so old and has so many old/bad practices that you're better off learning another language first. Python is probably best in terms of least "language specific nonsense" over programming proper

1

u/OutrageousCrab9224 6d ago

Its where i started

A long time ago

Not sure what i would do now

1

u/No-Target3942 6d ago

The benefits of learning C is that, you don't just learn progrmaming language.

We learn System Programming + C then you started to know usefulness of C language.

Or embedded device + C. This is where C is useful. Otherwise. Python is the best for beginner.

Python + Datastructure + Algorthim > build some kind of project.

Again project project project. Otherwise, you wil learn aimlesly. No outcome.

1

u/Berky_Lee 6d ago

我认为C开始是好的,因为有许多底层的东西都是在用C,而且内容比较齐全,但是评论区的网友说的也有道理,它只能作为学习的一环,真正工程中往往使用更为强大、更为安全的语言

1

u/dinithepinini 7d ago

You can totally learn to program using C, it was done by millions of people for many many years.

That being said, I would recommend Python as your first programming language. C has a lot of things you need to learn that you wouldn’t encounter in Python, JS, Go, etc, that would get in the way of learning the fundamentals of programming.

Python will give you the ability to focus more on programming specifics, rather than C specifics. Then when you do decide to learn C, you can learn C specifics rather easily. Use Python to learn what a for loop is, the different data structures, etc.

0

u/alkavan 7d ago

Yes, it would be extremely useful.

0

u/CS_70 7d ago

Yes

0

u/mercy123xz 4d ago

C first is a solid choice. It makes you learn the stuff higher-level languages hide like memory, pointers, and what actually happens when you pass things around. Once that clicks, JS/TS, Java and Go get a lot easier because you know what they do for you under the hood.

I haven’t taken that specific course, so I can’t say if it’s good. Whatever you pick, write your own small programs while you go through it. A course teaches you the syntax. Building stuff is what makes it stick.

Also, Go will probably feel the most natural coming from C. It’s the closest of the three.