Thread: Date validation

  1. #1
    Registered User
    Join Date
    Dec 2020

    Date validation

    Hi everyone!
    I've always been curious about programming so I'm taking a class as a hobby but seeing as I'm a total beginner I'm pretty lost.

    I have a tuple where some of the variables are a dates,:
    typedef struct {
        tDate packingDate;
        tDate bestBeforeDate;
    } tProduct;
    And then in a different c file I've been given this
    void dateInit(tDate *date, int day, int month, int year){
        date->day = day;
        date->month = month;
        date->year = year;
    And a bool validateDate(tDate d) where it checks that the dates are correct. I need to validate the dates but I don't understand what's the use of dateInit. Also, if these functions are in a different file, how should I use them inside my function?
    Do you know any book of webpage for beginners that could be helpful? I'm seeing I really need it and I'd be really grateful! Thank you!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Something like this
    tProduct milk;
    dateInit(&milk.bestBeforeDate, 25, 12, 2020 );
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-07-2012, 07:37 AM
  2. date validation
    By atlas07 in forum C++ Programming
    Replies: 1
    Last Post: 04-22-2010, 11:06 AM
  3. more date validation
    By bazzano in forum C Programming
    Replies: 5
    Last Post: 08-07-2005, 07:14 AM
  4. DATE <TIME.H> data validation
    By bazzano in forum C Programming
    Replies: 4
    Last Post: 08-07-2005, 01:10 AM
  5. date validation !!
    By rajesh23 in forum C Programming
    Replies: 2
    Last Post: 09-24-2003, 03:54 AM

Tags for this Thread