From the course: Advanced C Programming: Optimize Performance and Efficiency

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Send a structure to a function

Send a structure to a function

- [Instructor] Of all the variables you can pass to a function, a structure causes the most angst. Yep, even more than passing a pointer argument. Pointers are sinchy when compared with structures. To put a structure to work you must do two things. First, you need to define the structure and its members. Second, you need to declare a variable of that particular structure type. Both of these at elements come into play when using a structure as a function's argument. Open exercise file four seven structfunct1. The function showStruct is prototyped at line four. It returns nothing, but it accepts as an argument a person structure. Inside the main function, the person structure is defined, and a variable author of that structure type is declared. The structure is filled. Then at line 19, the showStruct function is called with the structure variable author as its argument. Inside the showStruct function at line 24 the structure's…

Contents