i am new c++ programming and just started with structures and pointers and i got a doubt.
i have a struct and void function()
struct my_struct
{
int x;
}
void my_function(){
my_struct* x=10
}
i need to return the value of my_struct* x to calling function.
most of the examples i saw returning a struct pointer doesn't use void function() instead they use like this
struct my_struct
{
int x;
}
struct my_struct* my_function( int* x){
//assign the value for X and return by assign a reference `&` from caller function
}
so is it not possible to return a struct pointer from a void function or do i need to use void pointers? pls bear with me and help me i am new to programming.