Simple Function

This is a discussion on Simple Function within the C Programming forums, part of the General Programming Boards category; Hey guys, I'm doing some exercises for Algorithms Complexity and thing is I'm stuck. I can't find to understand what ...

  1. #1
    C Beginner
    Join Date
    Dec 2011
    Location
    Portugal
    Posts
    187

    Simple Function

    Hey guys,
    I'm doing some exercises for Algorithms Complexity and thing is I'm stuck.

    I can't find to understand what this is supposed to do :

    Code:
    s = sum(K=0 ... N-1) a[k]
    Any idea ?

    Thanks.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,275
    It looks like an attempt to render summation notation, i.e., sum of a[k] from k=0 to k=n-1. Translating it to C would likely involve a for loop.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    C Beginner
    Join Date
    Dec 2011
    Location
    Portugal
    Posts
    187
    It it inside a while loop

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,275
    Ah well, it amounts to the same thing, though I still think that a for loop would be more idiomatic when converting from summation notation.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with simple function
    By alexl in forum C Programming
    Replies: 8
    Last Post: 12-23-2010, 10:46 AM
  2. simple function
    By barilla in forum C Programming
    Replies: 2
    Last Post: 02-08-2010, 12:09 PM
  3. Replies: 5
    Last Post: 10-17-2006, 09:54 AM
  4. Need help with simple c++ function
    By Ricochet in forum C++ Programming
    Replies: 7
    Last Post: 11-13-2003, 11:46 AM
  5. Simple Function but......I NEED HELP
    By justin69enoch in forum C Programming
    Replies: 7
    Last Post: 09-29-2002, 10:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21