I want a way to convert a string to struct variable.
ex)
struct DAT
{
int a,b;
char c,d;
float e,f;
}DAT1,DAT2,Main_data;
main()
{
Test_function(1)
}
Test_function(int num)
{
Main_data = DAT(num) // If num is 1, Main_data = DAT1
}
I want this program.
But I can't use define and pointer.
This mean I don't use * and # operators.
How do I do this?
struct DAT dat_array[2]; Main_data = dat_array[num-1];if ( num == 1 ) Main_data = DAT1; else Main_Data = DAT2;int main(void),void Test_function(int num), etc. Yes, compilers do still allow the sloppy old notation — but that doesn't make it good style and C99 and C11 explicitly disallow 'implicit int return type'.