Thread: Stripping Float numbers of the integer

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    10

    Stripping Float numbers of the integer

    how would i go about doing this?
    say i have a Recursion that works with a 2d array.

    Code:
    int box[3][3];
    
    int Recursion(int num);
    
    int main(void)
    {
        int row, column;
        Recursion(0);
        return 0;
    }
    
    int Recursion(int num);
    {
        if (num>9)
        {
            return num;
        }
        else
        {
            row=num/3;
            column=????????
            box[row][column]=rand()%9+1;
            Recursion(num+1);
        }
    }
    What would i have to do to to have just the decimal out of a float, or am i stuck with pointer fun?

  2. #2
    Registered User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    217
    I don't see any floats or pointers in your code...

    I don't really get your question but maybe you want this: http://cboard.cprogramming.com/showthread.php?t=107099

    EDIT: You also need to remove the ";" in the implementation of Recursion()

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    10
    There arnt pointers in my code... yet
    oh, and the link was exactly what i was looking for, thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 03:25 PM
  2. rounding numbers
    By maple23 in forum C Programming
    Replies: 3
    Last Post: 05-26-2008, 12:33 AM
  3. Opengl walking leg animation
    By Bobby230 in forum C Programming
    Replies: 3
    Last Post: 03-05-2006, 03:41 PM
  4. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  5. error in program????
    By SpEkTrE in forum C Programming
    Replies: 5
    Last Post: 11-24-2003, 06:16 PM