Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can you set data type of #define to long double?

I have a c-code where I define some variables for pre-processing using the #define command.

However, I think that there are ways to toggle between float and double data types by doing for example:

#define 1.0f     // float data type

or

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

#define 1.0     // double data type

Is there a way I can use it to set a variable of long double data types?

>Solution :

Suffix the float constant with l or L to give it type long double:

1.0L

Do note that float constants only have meaning to C. As far as the preprocessor is concerned, that’s just a string of four characters, no different from any other.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading