0
How to
How to make sizeof (dataInput); look at the number or text in dataInput and not the variable itself(4bytes)? Edit: I am trying to make: sizeof (dataInput); calculate the size of the data that the variable "writes"(e.g. : int dataInput="int"; sizeof (dataInput); // size of int not dataInput. Edit2. dataInput is a string (e.g. int)
3 ответов
+ 2
Sadly this is impossible in C++. The closest you can get is making a map of all types yourself and then look up the answer.
0
I don't think your question is clearly stated. please give an example or more info on what you are trying to accomplish. And the statement "4 bytes" at the end means what?
0
I think you want to print no.of items instead of variable size..
if it so...
for example
a[5]={1,2,3,4,5};
then try cout<<sizeof(a)/size of(a[1]);