Learning C++? Avoid these Beginner Mistakes...

  Рет қаралды 6,378

Caleb Curry

Caleb Curry

Күн бұрын

Пікірлер: 16
@codebreakthrough
@codebreakthrough Жыл бұрын
What mistakes have you made? Be notified of new C/C++ course: calcur.tech/c-cpp-newsletter
@joonyou9392
@joonyou9392 10 ай бұрын
Correct me if I'm wrong but, I think putting an assignment inside an if condition isn't strictly "always" true, but I think it's more that in C++ any non-zero number is considered true, and the assignement operator "returns" the assigned value, thus it depends on the assigned value, if it's 0 it'd be false, otherwise it'd be to if(x = 0) { ‎ //do something } //always evaluates to false if(x = 96) { ‎ //do another thing } //always evaluates to true I know this doesn't change anything but I thought giving out an explanation to this phenomenon would help some people understand why this happens or is allowed
@Chevifier
@Chevifier 10 ай бұрын
Been learning C++ for the past few months, any reason why you initialized age in the Person Constructor the way you did: Person() : age(0){//constructor stuff }; instead of doing: Person(){ age = 0; }; Its really confusing seeing it done interchangeably.
@BigJMC
@BigJMC 9 ай бұрын
The difference is efficiency, the first example you’re passing a member initializer, basically telling the program to construct the instance with the relevant values. (Basically like giving a blueprint of your house to construction workers and them building it based on that blueprint.) In the second part you’re basically telling program to construct the instance with a default constructor and then assign the relevant values to the variables. So in the second case your program might go and create a instance and set all the values to 0 or some default equivalent and then have to go back and reassign each variable with the relevant values as assigned in the constructor. (So basically telling the constructor workers to build a template house and then after completion telling them to change the rooms and renovate certain part of the house).
@only4posting
@only4posting Жыл бұрын
I've been having a weird issue with visual studio code, (mingw+gcc), with code runner + in tellisense(i think) installed. When i type some little code, i click on debug, it debugs fine, no errors. I then run it, and either the 'output' or 'terminal' will output the correct values. But then, no matter if i add some extra code or not, if i click again on 'debug', i immediately get an error, like 'no file permissions' ! I've checked everything... from install paths... files and folder permissions, etc etc, still the same result. One could think that the file, let's say, test03.exe, could be used, or could exist, somewhere, in the task or process list, and the compiler would simply not be able to overwrite the file... but when i get the error, the file doesn't even exist. Any idea ?
@shiv.shankar
@shiv.shankar Жыл бұрын
Try asking ChatGPT maybe?
@mackinator
@mackinator Жыл бұрын
Any file errors I get have generally been caused by using spaces in the file path. Spaces in any part of the path are a no go usually.
@only4posting
@only4posting Жыл бұрын
@@shiv.shankar done already. It talked about the file already existing in the task bar, and being locked by another process, like explorer.exe... but that wasn't the case. sounds like I'm going to install it on a VM, and mess with it until it works (or explodes :)
@shiv.shankar
@shiv.shankar Жыл бұрын
@@only4posting Ok. I have actually never debugged my code because it creates this json file and all that so i am actually terrified to do it. I will learn to debug after completing DSA
@Nathan00at78Uuiu
@Nathan00at78Uuiu Жыл бұрын
Number one mistake; learning c++. 😂jk jk
@knofi7052
@knofi7052 Жыл бұрын
The biggest mistake is learning C++ in the first place!😂 Just learn C instead!😉
@mimix.v
@mimix.v Жыл бұрын
But what about OOP =)
@nickton
@nickton Жыл бұрын
But C is so bad...
@Shreyas_Jaiswal
@Shreyas_Jaiswal 7 ай бұрын
​@@nicktonbut it's c++ dad
@PiotrPilinko
@PiotrPilinko 6 ай бұрын
"The more languages you know the more you are human" 😁 For me C is too primitive: c# (or even c++) allows to make a much better and robust code.
Smart Pointers in C++ (Stop Using new?)
17:18
Caleb Curry
Рет қаралды 13 М.
C++ Pointers to Pointers - Finally Understand Double Pointers
13:18
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,5 МЛН
كم بصير عمركم عام ٢٠٢٥😍 #shorts #hasanandnour
00:27
hasan and nour shorts
Рет қаралды 8 МЛН
Noodles Eating Challenge, So Magical! So Much Fun#Funnyfamily #Partygames #Funny
00:33
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 11 МЛН
CIS125 Can Drive With Methods M7ish
17:26
KO
Рет қаралды 30
Dynamic Memory with Malloc - Everything you Need to Know
13:51
Caleb Curry
Рет қаралды 10 М.
you will never ask about pointers again after watching this video
8:03
C++ Pointers - Finally Understand Pointers
15:56
Caleb Curry
Рет қаралды 218 М.
POINTERS in C++
16:59
The Cherno
Рет қаралды 1 МЛН
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 825 М.
struct Basics | C Programming Tutorial
24:44
Portfolio Courses
Рет қаралды 149 М.
Durability test of Galaxy Note 8 vs S24 Ultra 😁 #galaxynote8 #s24ultra #iphonexr
0:28
Samsung® telefonlara dair herşey
Рет қаралды 28 МЛН
Новый матовый iMac M4
0:59
Romancev768
Рет қаралды 453 М.
with the power of denden it can turn into an iPhone #shorts
0:10
Лучший лайфхак для клавиатуры 🤡
0:57
ПРОСТО ЛЕШКА
Рет қаралды 2,7 МЛН