0

hi guys we say that c language is a powerfull language but the use of '^' to represent 2*2*2 as 2^3 is restricted in c language where as the use of '^' is allowed in other simple languages.

4
Contributors
7
Replies
8
Views
10 Years
Discussion Span
Last Post by Nick Evan
0

^ isn't restricted, it just means something other than what you're trying to do. ^ is the bitwise exclusive OR operator, not an exponentiation operator. What you want is the pow function:

#include <math.h>

pow ( 2, 3.0 );
0

c language where as the use of '^' is allowed in other simple languages.

Just one point: C is not a simple language. Also, your poll makes no sense.

0

I'm not so sure. C can be easy, but some features require a lot of study to master. I'm not saying it is a diffucult language, but neither is it simple. I think the OP was referencing it to, say, BASIC.;)

0
echo " please explain me briefly abou pow statement;

printf("Foo\n");

echo "code";

Edited by mike_2000_17: Fixed formatting

0

Very simple, it's just like Narue said:

pow (number, power);

so: 2^3 in C would be pow(2, 3.0); don't forget to #include <math.h> in your C file.


[edit]

printf("Foo\n");

No, this site isn't a C compiler... :)

Edited by Nick Evan: n/a

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.