Purpose of a function

This is a discussion on Purpose of a function within the C Programming forums, part of the General Programming Boards category; Hello all, func(int* a, int b) { while((*a&(1 << b))==0); } Wwhat is the hidden purpose of this code? Thanks, ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    3

    Purpose of a function

    Hello all,

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


    Wwhat is the hidden purpose of this code?

    Thanks,

    Arun

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

    Tricky C


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

    http://forums.devshed.com/c-programm...on-748853.html

    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    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
    Posts
    1,528
    It's funny to see how impatient people are, and unwilling to learn by experimentation.

  6. #6
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,831
    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, 01:53 AM
  4. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 12:03 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 09:18 AM

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