I have some problems,please help me ,thank you.....
I want to know the size of some structs by their name. But ,
I read the name from a txt and the type of the name is string.When I use the function "sizeof()" ,I have problems.If the string is "int",function sizeof gives the size of the string, not the size of int.
How can I use sizeof to know the size of a struct by their name?
Please help,thank you ....
thank you,but this is not a good way...too many types
But you were happy to deal with all the variables by name? That makes no sense. There will be at least as many variables as types, if you make an instance of each type.
If you have them in a list, open your text editor and using the text editors built-in functions add
cout << sizeof(
to the front of each line, and
);
to the end of each line.
Then cut and paste the whole thing into your code and you will have a sizeof function for every type in the list ready to be compiled.