Thread: Passing a string to and from a function.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Also, you're basically converting a local variable, and then returning it (but not using the return value). What you probably want to do is loop through the array (until you hit the null-terminator), and then convert each cell into lowercase. Right? In that case, you can omit the return value altogether, too...
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Sebastiani View Post
    Also, you're basically converting a local variable, and then returning it (but not using the return value). What you probably want to do is loop through the array (until you hit the null-terminator), and then convert each cell into lowercase. Right? In that case, you can omit the return value altogether, too...
    Hey that's true, ch1 is not reassigned. My mistake. You don't need to use the return value after all.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    7
    Thanks for all your help... its working now! without pointers and using a void..Thankfully

Popular pages Recent additions subscribe to a feed

Tags for this Thread