C++ structs as arguments explained 🚚

  Рет қаралды 12,542

Bro Code

Bro Code

Күн бұрын

Пікірлер: 10
@BroCodez
@BroCodez 2 жыл бұрын
#include struct Car{ std::string model; int year; std::string color; }; void printCar(Car &car); void paintCar(Car &car, std::string color); int main () { Car car1; Car car2; car1.model = "Mustang"; car1.year = 2023; car1.color = "red"; car2.model = "Corvette"; car2.year = 2024; car2.color = "blue"; paintCar(car1, "silver"); paintCar(car2, "gold"); printCar(car1); printCar(car2); return 0; } void printCar(Car &car){ std::cout
@Dazza_Doo
@Dazza_Doo 2 жыл бұрын
Struts are value types when passing to functions/methods and need the ( Type &local_variable ) to pass the Pointer/address In C# this would be egregious but this is C++ baby, I need all the help I can get
@FrederikWollert
@FrederikWollert 8 ай бұрын
Good Video but you could've showed more the code from above where you refered from. Other than that good Video.
@danaildoganov
@danaildoganov 9 ай бұрын
#include struct player{ std::string name; int age; std::string team; }; void printPlayer(player player); void changeTeam(player &player, std::string team); int main(){ player player1; player1.name = "Messi"; player1.age = 38; player1.team = "Barcelona"; player player2; player2.name = "Ronaldo"; player2.age = 40; player2.team = "Real Madrid"; changeTeam(player1, "Inter Miami"); changeTeam(player2, "Al Nassr"); printPlayer(player1); printPlayer(player2); return 0; } void printPlayer(player player){ std::cout
@PCgamers69420
@PCgamers69420 3 ай бұрын
struct Weapon { std::string modle; double fireRate; bool isAuto; } void Shoot(Weapon) { Weapon weapon1; weapon1; weapon1;weapon1;
@wjoud1226
@wjoud1226 9 ай бұрын
my brain rotted
@darrenredondo9395
@darrenredondo9395 Ай бұрын
me too
ENUMS in C++ explained easy 📅
4:22
Bro Code
Рет қаралды 18 М.
you will never ask about pointers again after watching this video
8:03
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Is C BETTER than C++ for beginners? // Code Review
31:16
The Cherno
Рет қаралды 92 М.
C++ GETTERS & SETTERS explained easy 🔒
6:12
Bro Code
Рет қаралды 19 М.
What are C++ FUNCTION TEMPLATES? 🍪
5:15
Bro Code
Рет қаралды 11 М.
C++ CONSTRUCTORS explained easy 👷
8:55
Bro Code
Рет қаралды 32 М.
C++ arrays (#19) 🚗
21:09
Bro Code
Рет қаралды 26 М.
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 853 М.
C++ CLASSES & OBJECTS explained easy 🧍
10:54
Bro Code
Рет қаралды 44 М.
C++ pointers explained easy 👈
5:16
Bro Code
Рет қаралды 65 М.
Class vs Struct | C++ (What's the Difference?)
9:25
Caleb Curry
Рет қаралды 14 М.
C++ dynamic memory explained for beginners 🧠
5:49
Bro Code
Рет қаралды 22 М.