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???

Recommended Answers

All 4 Replies

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]) .

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

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 .

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.