C++ Tutorial for Beginners 24 - How to pass a structure to a function in C++

preview_player
Показать описание
passing structures to functions
pass one structure to function
Searches related to How to pass a structure to a function in C++
passing an array of structures to a function in c++
passing an array of structures to a function
passing an array of structures to a function in c
pass array of structs to function
how do you return a structure from functions
how to return a struct from a function in c++
pointer in structure
pointer struct
Structure function in C++ 9 posts
Member functions inside struct
Рекомендации по теме
Комментарии
Автор

Ya'll can talk all the shit you want about this guy, but he's the only mf who could show me how to pass a structure to a function as compared to a gazillion other videos and hours of blood, sweat, and tears. God bless this man!

gosports
Автор

You should have showed passing a pointer to the struct variable as well, for completeness. It is MUCH more efficient to pass a 4-byte (or 8-byte) pointer to a function, than it is to pass an entire structure...especially when structures get into the hundreds (or thousands) of bytes in size.

bluehornet
Автор

This video didn't say anything about :
-how do you return a structure from functions
-how to return a struct from a function in c++
and other stuff....

hychyc
Автор

I don't think the parameter in void printBook(Books book) requires the key word struct ( in fact it creates wierdness in my compiler) . If its declared properly, the compiler already knows what type Books is. Nor is it required when creating the object. " Books book1;" works fine.

truthnotlies
Автор

sir there is no need to write struct in main and in function parameter

uh
Автор

Hi can the struct or array of structure can be a template parameter? When I tried doing it I get the error book is not a type

reallifekichen
Автор

I have an error with the cout lines in printBook
"book1" was not declared in this scope

ModernTartarus
Автор

Again you dont need the struct keyword while assigning to arguments...

amanuel