0

if would like to print the size of data type entered by user. how can i do so (without using case and if)
is it possible to store the data type in a string and print the size of data type in that string???

4
Contributors
4
Replies
7
Views
5 Years
Discussion Span
Last Post by Ancient Dragon
0

A user doesn't enter a data type. They enter data that is put into a variable which is defined by a data type at compile time. So at compile time the data type size is already defined and can be output using sizeof([I]datatype/variable[/I]) .

0

A user doesn't enter a data type. They enter data that is put into a variable which is defined by a data type at compile time. So at compile time the data type size is already defined and can be output using sizeof([I]datatype/variable[/I]) .

i want something like this
i want to search a file for various data types and print the sizes of them acordingly

0

Then you need to create a mapping from data type to size and store it in a file. Once you've done that just search that file for the data type you are interested in.
Although, as WaltP has already mentioned, the size of a type is available at compile time using sizeof .

Edited by L7Sqr: n/a

0

i want something like this
i want to search a file for various data types and print the sizes of them acordingly

Post some examples of what will be in the file so that we don't have go guess that you want.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.