On this page
article
Functions and Structs
Functions and Structs
- Often, we need to pass a struct instance to a function. For example, in the previous lesson, every time we wanted to print a new struct instance we had to write a new print macro to print it. However, we can avoid multiple print statements by writing one print statement within a function and calling it when we need it.
Pass Structs to a Function
- The structs can be passed to a function and the function can be invoked when required.
output
Return Structs From a Function
Structs can also be returned from the functions.
output
Last updated a year ago.