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.

Recommended Answers

All 7 Replies

^ 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 );

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.

>C is not a simple language.
C is a very simple language. It's just really hard to use. ;)

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

please explain me briefly about pow statement.

echo " please explain me briefly abou pow statement;

printf("Foo\n");

echo "code";

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

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.