Thread: Better way maybe... but need assistance

  1. #16
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    no because we don't know what students is, what grade1 is, what grade2 is, etc. Thats why I said variable declartion

  2. #17
    Registered User
    Join Date
    Sep 2004
    Posts
    40
    sorry misunderstood.. Here you go..


    Code:
     struct grades  /*Structure to put the text into.*/
        {
         char students[30];
         int grade1;
         int grade2;
         int grade3;
        };
       struct grades students[30], grade1, grade2, grade3;

  3. #18
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Ok so right now students is an array of struct grades. grade1, grade2, grade3 are all struct grades.

    So when you call
    Code:
    readfile(students[30], grade1, grade2,grade3);
    all the parameters are grades not an array of char, an int, an int, an int.

  4. #19
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Oh, so it's like I said, you aren't passing the arguments correctly. Do you see what you're doing here? You should, because I already mentioned it to you once.
    Code:
    struct grades students[30], grade1, grade2, grade3;
    Let's use the Way-Back-Machine(TM) and see exactly what it was I wrote...
    Quote Originally Posted by quzah
    To be precise, it's an array of 30 structures, plus 3 individual ones, and a pointer to a structure.

    Quzah.
    The only thing different is that you got rid of the pointer. I don't think you really understand what a structure is.

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #20
    Registered User
    Join Date
    Sep 2004
    Posts
    40
    I am not passing the structure though.. I am only passing the things in the structure.. such as the students, grade1, grade2, grade3.... Then what do I have to do to get rid of the errors and call the function properly... I am a little confused here...

  6. #21
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    No you aren't. If you did you would have something like
    Code:
    somevar.grade1
    Last edited by Thantos; 02-06-2005 at 06:41 PM.

  7. #22
    Registered User
    Join Date
    Sep 2004
    Posts
    40
    So how do I correct it or what can I do to fix it.. Your statement was a little vague for me... I am still new at this so I am a little slow... sorry....

  8. #23
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Well I'd suggest you read up on how to use a structure.
    http://faq.cprogramming.com/cgi-bin/...&id=1073086407

  9. #24
    Registered User caroundw5h's Avatar
    Join Date
    Oct 2003
    Posts
    751
    here is another one to help you better understand.
    Warning: Opinions subject to change without notice

    The C Library Reference Guide
    Understand the fundamentals
    Then have some more fun

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hello,i need assistance in completing the code
    By toader in forum C++ Programming
    Replies: 1
    Last Post: 06-22-2009, 03:32 AM
  2. Variable Timer assistance
    By rich2852 in forum C Programming
    Replies: 2
    Last Post: 01-21-2009, 05:43 AM
  3. Any assistance would be greatly appreciated
    By iiwhitexb0iii in forum C Programming
    Replies: 18
    Last Post: 02-26-2006, 12:06 PM
  4. Need some more assistance
    By Thantos in forum Windows Programming
    Replies: 6
    Last Post: 08-14-2003, 12:13 PM
  5. Need assistance for major text base Arena RPG project
    By Ruflano in forum C++ Programming
    Replies: 0
    Last Post: 04-04-2002, 11:11 AM