function prototype

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Art Cummings

    function prototype

    Hello all,

    I'm trying to write a function prototype that includes an array of
    structures. I'm not sure how to write it. I'm also not sure what the call
    to a function that uses this prototype would look like. From what i've read
    on the web, it needs to be a pointer to an array. I'm not sure even where
    to begin. I've written function protoypes for arrays and 2d arrays but when
    I write it for the structure, i get compiler errors.

    any help...

    Thanks
    Art


  • Art Cummings

    #2
    Re: function prototype

    Here's the code I have.

    I get an undefined reference to getInfo, error.

    Thanks
    Art

    #include <iostream>
    #include <fstream>
    #include <string>
    #include <conio.h //necessary for the _getch function

    using namespace std;



    const int SIZE = 15; //size for all arrays in student structure

    struct Student
    {
    char fName[SIZE]; //array for first name
    char lName[SIZE]; //array for last name
    char attendance[SIZE]; //array for attendance
    int days[SIZE]; //array for days
    };

    void getInfo(Student[]);


    int main()
    {
    Student studentInfo[30]; //define an array of 30 students
    getInfo(student Info);
    system("PAUSE") ;
    return 0;
    }
    void getInfo(Student &s)
    {
    }


    Comment

    • Art Cummings

      #3
      Re: function prototype

      Thanks Brian, we haven't dealt with vectors yet.

      Art


      Comment

      • Art Cummings

        #4
        Re: function prototype

        oops,

        mea culpa

        Art
        Brian

        Comment

        • Art Cummings

          #5
          Re: function prototype

          Thanks V.

          You may need to pay a bit more attention to declarations (and what they
          mean), otherwise C++ is going to be very difficult for you.

          I'm re-considering that dish washing job.

          Art




          Comment

          • Art Cummings

            #6
            Re: function prototype

            Brian, I thought top posting was where you include the previous message in
            your reply.


            Art


            Comment

            • Art Cummings

              #7
              Re: function prototype

              >
              Please don't top-post. Your replies belong following or interspersed
              with properly trimmed quotes. See the majority of other posts in the
              newsgroup, or the newsgroup FAQ.
              >
              >
              >
              >
              Also, see this:
              >
              <http://www.caliburn.nl/topposting.html >
              >
              >
              >
              >
              Brian
              Gotcha, I think this is what you mean. Trust me Brian, i'm not trying to be
              rude, just trying to learn the correct etiquete and to follow.

              Thanks

              Art


              Comment

              Working...