Thread: Pointers!

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    11

    Pointers!

    I just wanted to tell all those folks (including some very foolish people who couldn't solve the problem, but just just commented petty things about the program) that I finally solve the problem.

    Here's how I did it:

    Code:
    #include <stdio.h>
      int convert(int time, int *hours, int *mins, int *secs);
    
      int main()
        {
        int time, secs, mins, hours;
        printf("Enter the number of time in seconds: ");
        scanf("%d", &time);
        convert(time, &hours, &mins,&secs);
        printf("\nHours: %d", hours);
        printf("\nMinutes: %d", mins);
        printf("\nSeconds: %d", secs);
    
        return 0;
        }
    
       int convert (int time, int *hours, int *mins, int *secs)
        {
        *hours = time / 3600;
        time %= 3600;
        *mins = time / 60;
        time %= 60;
        *secs = time;
        }
    Thanks to all those who really tried to help me!!!!!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    You've certainly got the art of posting on the wrong board sorted out
    Moved from the C# board to the C board.
    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.

  3. #3
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    I just wanted to tell all those folks (including some very foolish people who couldn't solve the problem, but just just commented petty things about the program) that I finally solve the problem.
    WOOT..you finally did it..im so happy !!! *wipes a tear*

    including some very foolish people who couldn't solve the problem
    from the rep that i got from you, m sure that i am one of them neways, i dont mind such stuff..happy coding
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using pointers to pointers
    By steve1_rm in forum C Programming
    Replies: 18
    Last Post: 05-29-2008, 05:59 AM
  2. function pointers
    By benhaldor in forum C Programming
    Replies: 4
    Last Post: 08-19-2007, 10:56 AM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. Staticly Bound Member Function Pointers
    By Polymorphic OOP in forum C++ Programming
    Replies: 29
    Last Post: 11-28-2002, 01:18 PM