hey can any body tell me how to pass entire structure to a function ....if i donot want the function to return a value (void type function) how can i define and declare it.
hey can any body tell me how to pass entire structure to a function ....if i donot want the function to return a value (void type function) how can i define and declare it.
the query is both for c as well as c++
u have to declare and initialise your struct first (in the main or where ever u wish)
int main()
{
//declare your struct
struct my_type{
int num;
char letter;
}
//put value to your struct
struct my_type my_var{1,'c'};
// here is how u parse it to a function
my_function(my_var);
}
//this is your fucntion prototype
void my_function(struct my_type myvar)
{
//..... do something.....
}
note: the above is for standard c though
Bookmarks