Thread: Purpose of a function

  1. #1
    Registered User
    Join Date
    Mar 2010

    Purpose of a function

    Hello all,

    func(int* a, int b)
    while((*a&(1 << b))==0);

    Wwhat is the hidden purpose of this code?



  2. #2
    Registered User
    Join Date
    Sep 2006
    To see how long it takes you to post a duplicate thread, under a different name?

    Tricky C

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Not to mention, cross-post
    Purpose of a function

    > To see how long it takes you to post a duplicate thread, under a different name?
    I checked the IP addresses, it looks like they both go to the same college.
    Figures they would both post the same homework, if they're both on the same course.

    They did sign up at the same time though
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    London, United Kingdom
    LOL, busted by detective Salem. Nice one...
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  5. #5
    ... kermit's Avatar
    Join Date
    Jan 2003
    It's funny to see how impatient people are, and unwilling to learn by experimentation.

  6. #6
    Registered User
    Join Date
    Sep 2008
    Toronto, Canada
    That while loop will never stop. If it executes at all.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sudoku Brute Force Algorithm Help (recursion?)
    By ridilla in forum C Programming
    Replies: 22
    Last Post: 05-07-2010, 03:31 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM