Thread: Structure Help...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    5

    Structure Help...

    To Whomever can Help Me;

    I am having trouble with this structure program. I believe the problem is in the scanf statement or in the initial declaration of the structure. Any pointers would be helpful and appreciative. Thank you!

    Dave

    #include<stdio.h>
    struct date{
    int day;
    int month;
    int year;
    };
    main()
    {
    struct date;
    int dates[5];
    int i;
    for(i = 0; i < 5; i++)
    {
    printf("Please enter the date (dd:mm:yy)");
    scanf("%d%d%d", &dates[i].day, &dates[i].month, &dates[i].year);
    }
    }

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>struct date;
    >>int dates[5];
    Try

    struct date dates[5];

    and please use code tags when posting code.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem referencing structure elements by pointer
    By trillianjedi in forum C Programming
    Replies: 19
    Last Post: 06-13-2008, 05:46 PM
  2. Replies: 5
    Last Post: 02-14-2006, 09:04 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM
  5. C structure within structure problem, need help
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 11-30-2001, 05:48 PM