Search:

Type: Posts; User: cph

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    12
    Views
    1,146

    hooray...!:cool: well, it also works with...

    hooray...!:cool:

    well, it also works with double.


    inline double fmax(double a, double b)
    {
    const double result[2] = { a, b };

    return result[static_cast<unsigned int>(result[0] <...
  2. Replies
    12
    Views
    1,146

    guilty as charged. :D

    guilty as charged. :D
  3. Replies
    12
    Views
    1,146

    do I have to do this: inline int fmax(int a,...

    do I have to do this:


    inline int fmax(int a, int b)
    {
    const int result[2] = { a, b };

    return result[static_cast<unsigned int>(result[0] < result[1])];
    }
  4. Replies
    12
    Views
    1,146

    custom min/max function

    I probably saw this somewhere, but can't remember where and when.:D


    inline int fmax(int a, int b)
    {
    const int result[2] = { a, b };

    return result[result[0] < result[1]];
    }
  5. hmm...you probably could combine that (command...

    hmm...you probably could combine that (command line args) with this
  6. you could start from here...

    you could start from here.
  7. Replies
    1
    Views
    2,425

    #include int main (void) { ...

    #include <stdio.h>

    int main (void)
    {
    printf("\b");

    return(0);
    }

    well, that was easy...:D
  8. Thread: question on syntax

    by cph
    Replies
    5
    Views
    856

    well, sometimes some people like to do things...

    well, sometimes some people like to do things their own way, hence the function pointer :D
  9. Thread: question on syntax

    by cph
    Replies
    5
    Views
    856

    if I'm not mistaken, that's a pointer to a...

    if I'm not mistaken, that's a pointer to a function that takes a pointer to type void as a parameter and returns nothing (void).
  10. Replies
    14
    Views
    2,086

    u r welcome :)

    u r welcome :)
  11. Replies
    14
    Views
    2,086

    sprintf won't print anything, it stores the...

    sprintf won't print anything, it stores the result in a buffer
  12. Replies
    14
    Views
    2,086

    well you could use a temporary array of chars to...

    well you could use a temporary array of chars to store the intermediate result, do some string dump, and push the final result to the stack.
  13. Replies
    14
    Views
    2,086

    sprintf probably could do the trick EDIT: oops!

    sprintf probably could do the trick

    EDIT: oops!
  14. Replies
    10
    Views
    1,999

    ah...okay :D dear OP, if you want to get a...

    ah...okay :D

    dear OP,
    if you want to get a positive result (instead of negative), then you should do this (just like what ssharish2005 did)


    int total = 25 * 50 - 100;
  15. Replies
    10
    Views
    1,999

    total = 100 - 25 * 50 and the answer will be...

    total = 100 - 25 * 50

    and the answer will be -1150. what's wrong with that?


    total = 100 - 25 * 50

    total = 100 - 1250

    total = -1150
  16. Replies
    39
    Views
    4,958

    pick one, please. um...I suggest you should...

    pick one, please.
    um...I suggest you should really get started.
  17. Replies
    9
    Views
    1,465

    how about a combination of strcspn & strtol?

    how about a combination of strcspn & strtol?
  18. Replies
    32
    Views
    3,122

    hmm...yes, it should be int main (void)

    hmm...yes, it should be int main (void)
  19. Thread: C questions

    by cph
    Replies
    33
    Views
    3,947

    3000 lines of code get posted in a forum? that'd...

    3000 lines of code get posted in a forum? that'd be a world record, LOL.
  20. Thread: C questions

    by cph
    Replies
    33
    Views
    3,947

    I think the OP said that he/she is going to be...

    I think the OP said that he/she is going to be back anytime soon, let's hope not for asking some more useless questions :)
  21. Replies
    4
    Views
    1,100

    ptrMC=&myCars[3]; I think it should be ...

    ptrMC=&myCars[3];

    I think it should be


    ptrMC = myCars;


    and
  22. hmm...are you planning to participate in some...

    hmm...are you planning to participate in some kind of obfuscated programming contest?
  23. Thread: Exit_success

    by cph
    Replies
    12
    Views
    12,446

    Thanks to everyone for the explanation :) ...

    Thanks to everyone for the explanation :)



    sorry, I should have done some searching first :)
  24. Thread: Exit_success

    by cph
    Replies
    12
    Views
    12,446

    does EXIT_SUCCESS always expand to 0 on all...

    does EXIT_SUCCESS always expand to 0 on all system/OS ?
  25. Thread: Exit_success

    by cph
    Replies
    12
    Views
    12,446

    Exit_success

    if main should return 0, why there exist EXIT_SUCCESS?

    do I have to do this :

    #include <stdio.h>
    #include <stdlib.h>

    int main (void)
    {
    /* blablabla... */
Results 1 to 25 of 86
Page 1 of 4 1 2 3 4