Pointers!

This is a discussion on Pointers! within the C Programming forums, part of the General Programming Boards category; I just wanted to tell all those folks (including some very foolish people who couldn't solve the problem, but just ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,422
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Nov 2004
    Location
    India
    Posts
    515
    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, 09:33 AM
  4. Staticly Bound Member Function Pointers
    By Polymorphic OOP in forum C++ Programming
    Replies: 29
    Last Post: 11-28-2002, 12:18 PM

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