Will it make a difference or not?
Is there an advantage to starting C first over C++?
Falling into your wing while paragliding is called 'gift wrapping' and turns you into a dirt torpedo pic.twitter.com/oQFKsVISkI— Mental Videos (@MentalVids) March 15, 2023
C is a simpler language but it will teach you how to work with memory and write efficient and sensible code. C++ is a beast that you can then spend years trying to learn.
How long should I spend on C before getting into C++?
Until you can write linked lists, BSTs, graphs and hash tables in C from scratch
>write linked lists
That shit is foul fr on god
t. first year comp sci
it's extremely simple and if you can't do it already then you will be filtered later on
I worked with a guy who started at the company a few years before me. C++ only. There's no way he could have implemented a linked list. Nice guy though and he was good at other aspects of programming just not the actual code writing part.
>good at other aspects of programming
that's because it's ridiculously easy to fake it until you make it in the tech industry with good enough social skills
the standard library brain
Not that anon but made a typedef struct with a pointer and value and called it node and then made a function to add more nodes by setting the pointers to point to another Node var. So proud of myself! And did all that by reading the first sentence on Wikipedia about Linked Lists!
You need to be able to:
index the linked list
search through the linked list
add and remove nodes
not the hardest the thing in the world but not trivial
btw if you leave a dangling pointer your mum will die in her sleep tonight
all of those operations are indeed trivial
As long as you feel like it teaches you something new - and I don't mean language features, you shouldn't stop once you know all the syntax and most of standard library stuff. I'd say pick a project, maybe something like Tetris once you feel more comfortable. It should make you learn how to use heap, how to write reusable code, how to work with input... It's also probably best if you avoid copying some existing example but work your way one problem at a time. That kind of experience is useful no matter the language, but I think C teaches it nicely. With C++ you have so many options how to solve certain problems, it can get quite overwhelming, I fear that's not the best way to learn programming... Of course I'm saying all this assuming you haven't programmed much before so take it as that.
Thanks anon been following along with a book. I learned C++ a long time ago and I thought the same thing.
No problem. You know, I've been programming C++ professionally for 6 years and before that used it in small projects at least 2... And I'm not even trying to teach myself all of its features. Just pick what you want to do, focus on the problems at hand, look up information on how to solve them (math, code design choice, language feature, whatever). It's most of what programmers in the field do daily anyway. And lastly, IDK how serious are about programming or if you are a compsci student already, but having a general overview in that area is very useful, so you might wanna start looking at the subjects: https://teachyourselfcs.com/
I mainly wanted to get into C++ to do game hacking. But I heard learning C can be a better start so yeah for now at least thats what I will do for fun at least hoping after I get a degree I could use this to pivot into cyber security or something...
Is C the only language with which you can learn how the memory works? Like could I do with Go (e.g., garbage collected and not pointer arithmetic)?
>C++ is a beast that you can then spend years trying to learn.
No, but the STL is
C++ without any included libraries is barely different
OP should learn C++ without using anything from the STL
that's basically the same as learning C, but instead you practice classes, polymorphism, etc that is seen in other languages
how small is that etc?
there's basically nothing else
templates, but, they're not a very common concept so dont even bother learning that until you're a guru
I consider templates to be pretty basic.
Just to add to that, some template meta-programming tasks are indeed hard and not something you will do everyday but just creating something like a templated container is easy.
>practice classes, polymorphism, etc
Jesus fucking christ. Now I know why I stopped coming to this shithole for anything other than a laugh.
It's very hard to pry people away from their nursing bottle (object oriented programming).
You can start anywhere. At the most basic level there is hardly any difference between languages. They only start to diverge as the complexity of what you are trying to accomplish goes up.
>starting with meme languages in 2020+3
lmao start with gpt4 retardkun
That's not a programming language.
gpt5 will be written in gpt4.
That doesn't make any fucking sense.
If your going to call chat gpt a coding language then so is google anon
Get inseminated, I don't even know C# or use C++. And no, I don't have a single book on programming.
kys, retarded idiotic nagger homosexual cuck.
gpt4 is a nothingburger so far you actual retardkun
whenever you see somebody blindly worshipping gpt, you know they don't actually have any knowledge of the field at all
Its basically like a very smart google. AI is getting there but GPT is overhyped I thought it was insane at first but it can't even do any complex mathematics. It fails when it doesn't have good data and fills in the gaps with nonsense.
It also flat out lies to you or even makes shit up. Give it a pastebin of code and ask it what code it's in, then ask it to tell you what's on line XXX, it will just make shit up.
In a way its very human in the sense that people have hallucinations or make up stuff when they don't really understand whats going on
Yeah that's fine, all I'm saying is a lot of the shit it says has to be double checked and fixed. It's nowhere near a solution, it's only a tool at this point.
I would say its better then a lot of Indians anon...
You wouldn't be wrong anon...
Funny part is street shitters will be offering to complete coding jobs using gpt4 and their results will finally work...
Depends on what they views as "programming". For some people a few lines of code that scrapes a website and calls an API with that content then spits back the results is a program.
All roads eventually lead back to C. It doesn’t matter which one you choose, you’ll come around in the end, a better programmer.
start with assembly
I started learning C++ after learning C#.
C++ isn't as hard as people make it out to be but if it's your first programming language starting with C is probably a good idea.
>C++ isn't as hard as people make it out to be
It's actually much harder, but the problem is that this won't be obvious until you have significant experience with it.
C++ isn't particularly hard to learn the basics of, you can learn enough to write and modify basic programs in it without that much more effort than most languages, and once people have gotten to that level, they will makes claims like the poster I'm responding to have. But C++ offers such a huge quagmire of subtle ways to just fuck things up when you actually try to create complex programs in it that aren't at all obvious, and trying to read arbitrary C++ code is usually far tougher than most other languages in practice.
Now, this isn't to say that C++ is unusable, there are ways to manage it and its complexity, but you basically always want to have someone who knows it way better than you do to guide you when working on any substantial project using it unless you've spent a ridiculous amount of time understanding its pitfalls.
Acting like the pitfalls of C++ are things that any "sufficiently smart student" will just 'deal with' is precisely the midwit take. Generally, the smarter and more experienced someone is, the more aware of the language's problems they are and how much caution it is wise to have when using it. If you're at a level where you're like "I totally remember to use free/delete, this stuff shouldn't be a problem for me", then you don't get it. Take advice from
tell me more wise man, what are the actual bombs that i should avoid by using the most performant language in the planet hearth
>C++ isn't as hard as people make it out to be
That depends how far into it you go. When you get into template metaprogramming it gets pretty hairy.
"move" semantics are enough to filter a lot of people, it seems, and that's just the tip of the iceberg.
C is a bomb, C++ is a bomb in a sea of naplam. Almost no field of software uses C or C++ unless you're doing very rarefied things like coding high performance algorithms for HFTs or signal processing.
>Almost no field of software uses C
>implying you ever had a job
My job is writing C code for industrial thermal cameras. Innumerable platforms are built in C/C++, but you will rarely have to touch the language itself.
Do you have any experience with Rust? Do you think it's a better option for creating new software?
Never ever have anything to do with c++ its cancer that will ruin your life. Its just not worth it.
As a C++ programmer I must agree with your advice. It's great for my job security
Is there any advantage to C being a first language over say one of the enterprise CRUD langs?
Believe it or not, there still pitfalls that will bite you in the ass with C++ that are even beyond the language itself, more to do with implementation of the underlying compiler and standard libraries.
Perfect example is as follows ... the WASM committee trying to get the std library into a form useable with gcc/clang as WASM is totally roadblocked now by support for exception handling implicit within the compilation of C++ to WASM to include the std library. Fucking exception handling IS NOT SUPPORTED IN CLANG's/GCC's wasm32/wasm64 bytecode output because its fucking implementation specific to the compiler + std lib.
They have not admitted this but its way WASI (the attempt at providing C++ users with a WASM compiled std lib + libcstd) is currently DEAD IN THE WATER.
I have given up on clang/gcc compilation of C++ to wasm32/wasm64 now with its flags because the fuckers can't guarantee an implicit language construct (exceptions) that simply must work to provide proper std library supprt.
I've got back to just writing C to compile to WASM using clang once I realised this shit. Its so fucking infuriating in invest time on something to discover its a dead end.
This is just one example of how C++ will fuck you in ass beacuse of how the underlying machinery supporting C++ programing is itself fucked.
C++ seems to cause brain damage so I'd start with C.
Rust|rust|Cnile| C | c |C++|c++
everything C has, C++ also has. C++ is built on top of C. So if you want to be a bit more than a pajeet stackoverflow copier, do learn C, it will help you understand what the countless C++ features actually do
This actually isn't true and there's meaningful shit you can do in practice in C that you won't be doing in C++.
To make a counter point to
in pure C you now get guarantees that you can cast a pointer to a given structure to a pointer to its first member:
C99 22.214.171.124 (13): A pointer to a structure object, suitably converted, points to its initial member... and vice versa. There may be unnamed padding within as structure object, but not at its beginning.
Because of this, it's basically trivial to then implement 'custom' polymorphism using single inheritance in C without relying on a pre-existing class system, you create a structure containing the function pointers you want, and include a pointer to that as the first member of another structure and then supply the implementation you need and otherwise not have to bother with C++ style classes.
Likewise, implementing APIs is virtually always vastly more simplified and more compatible using C as opposed to have multiple C++ programs try to pass shit between each other.
variable length arrays (run time on the stack) are C-only
immensely useful, no equivalent for C++ that I'm aware of, in C++ either it's on the stack with a fixed size at compile time, or it's on the heap
I've been writing C++ for 12 years, is there anything I can learn from using pure C?
>is there anything I can learn from using pure C?
yes you will learn to be comfy
once you use VLAs you will start to hate C++ for being too reliant on the heap
cpp combines the worst parts of c and java
DO NOT compare j*va with any respectable programming language
Yes if you start with C and then you stop there and forget about C++.