Functions - Passing structure to a function as an argument

Passing structure to a function as an argument :

Like arrays, structures can also be passed to function as an argument. If it is declared within function or a block it will become local variable declaration. Hence it can be accessed only within which it is declared. Unless we pass structure to function as an argument it can't be accessed. To access structure in function without passing it as a function argument then structure must be declared as global variable. Similar to arrays structure can also be passed by following methods,

1. Pass By Value
2. Pass By Reference
3. Access directly when it is declared as global variable

 In next post I will show with examples.


Comments