//data type 1
typedef struct t_A{
int mJ;
}A;
//data type 2
typedef struct t_B{
int mK;
}B;
//Function returning B object which is a rValue
B funcRetB(void)
{
B test;
test.mK = 9;
return test;
}
void main(void)
{
A a;
a = (A)funcRetB(); //How to typecast this without defining a variable of B?
}
The above code gives error "error C2440: 'type cast' : cannot convert from 'B' to 'A'". Is it possible to resolve this error in C?