Life of student

All about Programming , C++ ,Fedora

Some useful unseen functions and constants in C/C++

Posted by pankaj4u4m on October 23, 2010

I was searching for such articles long time. During googling I found some of the functions and constants available in C/C++.
1>Constants:
* __LINE__ : integer contains line number
* __FILE__ : string contains name of file
* __DATE__, __TIME__ : you can understand by name
* __func__, __FUNCTION__ : name of function in inside which it is used
* __PRETY_FUNCTION__ : name + signature of function in C++, same as above two in C
* __STDC__ : variable defined when compiling in C
* __cplusplus : variable defined when compiling in C++
mathematics:-
* M_E : The base of natural logarithms.
* M_LOG2E : The logarithm to base 2 of M_E.
* M_LOG10E : The logarithm to base 10 of M_E.
* M_LN2 : The natural logarithm of 2.
* M_LN10 : The natural logarithm of 10.
* M_PI : Pi, the ratio of a circle’s circumference to its diameter.
* M_PI_2 : Pi divided by two.
* M_PI_4 : Pi divided by four.
* M_1_PI : The reciprocal of pi (1/pi)
* M_2_PI : Two times the reciprocal of pi.
* M_2_SQRTPI : Two times the reciprocal of the square root of pi.
* M_SQRT2 : The square root of two.
* M_SQRT1_2 : The reciprocal of the square root of two (also the square root of 1/2).
function I will post later If you can please contribute

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.