Thread: Help

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    2

    Unhappy Help

    How can implement exponents in C
    im trying to do this line
    total+=2**counter;
    which is 2 to the exponent 'counter' but borland 5.5 compiler spits this error message out at me
    --> Invalid indirection in function
    how can I ix this ?

  2. #2
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    #include<math.h>

    pow( 2.0, counter );

    Or, if counter is an integer, you can just leftshift.

    1 << counter;
    Last edited by Polymorphic OOP; 01-17-2003 at 10:36 PM.

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    2

    Thank you!

    Thank you very much for replying.
    too bad I found that command after I posted on my professor's resource website :P, anyhow it's nice to know someone cares thx again poly

Popular pages Recent additions subscribe to a feed