Help with mult-dim arrays and pointers to them

This is a discussion on Help with mult-dim arrays and pointers to them within the C Programming forums, part of the General Programming Boards category; Hey everyone... I am really up a creek with this assignment in my C programming class. I was hoping that ...

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    4

    Help with mult-dim arrays and pointers to them

    Hey everyone... I am really up a creek with this assignment in my C programming class. I was hoping that someone here might have some input.

    We have been working over most of the semester on a program that organizes and prints out a simple array of student grades on the screen that are user enter-able. Each assignment, we have been taught a new way to do this, starting with functions. This time we are supposed to use pointers to pass the address of the multi-dimensional array of student grades around to the different functions. The problem is, I have no idea on how to do this... I don't have any problems passing a single-dimension array around but with a multi, it just keeps dying out on me. To help keep the conecepts simple in my head I've created a small test program that does on a smaller scale what we are being asked to do for the large program. Here is its code:
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    /*Here is printTableTitle's prototype*/
    void printTableTitle( const int **theTitle);
    
    void printTableTitle( const int **theTitle)
    {
    int i, j;
    for (i = 0;i <= 4; i++)
    {
    printf("\n%hu\n", *(*theTitle));
    }
    
    }
    
    main()
    {
    int **array;
    int nrows = 4;
    int ncolumns = 4;
    int i;
    
    array = malloc(nrows * sizeof(int *));
    for(i = 0; i < nrows; i++)
    array[i] = malloc(ncolumns * sizeof(int));
    
    for (i = 1; i <= 4; i++)
    {
    printf ("Type something!");
    scanf("%hu", &array[1][i]);
    }
    printTableTitle(array);
    
    }
    When I run the program all I get is a the prompt to enter the numbers then it just spits back 0's at me. Plus it is telling me that there I am trying to pass an argument of an incompatible pointer type at line 34.

    If anyone can help me, maybe by providing an example of what WOULD work, I would really really appreciate it because I am sooo stuck right now its not even funny :-(

    Thanks!
    skybolt_1

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You are printing wrong. You must print each cell indifivually. Use a nested loop. Pass the array dimensions as function arguments.
    Code:
    for( y = 0; y < foo; y++ )
        for( x = 0; x  < bar; x++ )
            display_cell( );
    Where display_cell is your printf statement.

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

  3. #3
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    Don't forget to free() allocated memory.
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    /*Here is printTableTitle's prototype*/
    void printTableTitle( int **theTitle );
    
    void printTableTitle( int **theTitle )
    {
    	int i, j;
    	for (i = 0;i < 4; i++)
    	{
    		for( j = 0; j < 4; j++ )
    			printf("%d ", theTitle[i][j] );
    		printf("\n");
    	}
    }
    
    int main()
    {
    	int **array;
    	int nrows = 4;
    	int ncolumns = 4;
    	int i, j;
    
    	array = (int**)malloc(nrows * sizeof(int *));
    	for(i = 0; i < nrows; i++)
    		array[i] = (int*)malloc(ncolumns * sizeof(int));
    
    	for (i = 0; i < 4; i++)
    	{
    		for( j = 0; j < 4; j++ )
    		{
    			printf ("Type something!");
    			scanf("%d", &array[i][j]);
    			while( fgetc( stdin ) != '\n' );
    		}
    	}
    	printTableTitle(array);
    
    	for(i = 0; i < nrows; i++)
    		free(array[i]);
    	free(array);
    
    	return 0;
    }

  4. #4
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    NOTE:: Ignore the malloc casts!

  5. #5
    Registered User
    Join Date
    Apr 2003
    Posts
    4
    When you say ignore the malloc casts do you mean that I should remove the (int*) portion of the malloc lines?

    Sorry if I'm asking dumb questions but I am NOT a good programmer... I need this course to graduate then I never have to do it again... hehehee

    Thanks for all the help btw!!!!

    skybolt_1
    Last edited by skybolt_1; 04-30-2003 at 04:26 PM.

  6. #6
    Registered User
    Join Date
    Apr 2003
    Posts
    32
    Malloc cast he mean like this:
    Code:
    (int**)malloc(nrows * sizeof(int *));
    Remove the (int**) it's not needed, compile your code with '.c' extension (as C) and you wont need to cast.

  7. #7
    Registered User
    Join Date
    Apr 2003
    Posts
    8
    weird coincidence, i have a similar problem, altho that code doesnt seem to be working even though its in the same context.

    In theis situation, i've filled a 2 dimensional array and am printing the first dimension of the array as a string then incrementing [i] to move to the next dimension. inarray[MAXINDEX][i] is the array.
    [code]
    int printmessage()
    {
    int i;
    for (i = 0; i < MAXINDEX && i != '\n' ; i++)
    {
    printf("%s ", inarray[i] );
    }
    }

    it does the job, but my problem is that it prints the entire array, including the empty lines, whereas i want it to print only the lines which contain values and to terminate the function as soon as it reads an array with the first value being '\n' (the terminator).

    Anyone got any ideas?

    Thanks

  8. #8
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by yank
    In theis situation, i've filled a 2 dimensional array and am printing the first dimension of the array as a string then incrementing [i] to move to the next dimension. inarray[MAXINDEX][i] is the array.
    That's your whole problem. "MAXINDEX" is not a valid array entry. You should never reach or exceed "MAXINDEX". You should go from zero to one less than that number.

    That aside:
    Code:
    int printmessage()
    You have no parameters to your function. Are you accessing globals or what? If you are trying to use parameters, specify them. If not, use void.
    Code:
    for (i = 0; i < MAXINDEX && i != '\n'
    i is being compared to the decimal value of '\n'. This isn't comparing what the line contains. It's comparing the value of 'i' against the value of '\n'.

    Try comparing the contents of the array. Access the first element of the array at that index and see if it equals a newline.

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

  9. #9
    Registered User
    Join Date
    Apr 2003
    Posts
    8
    Originally posted by quzah

    Try comparing the contents of the array. Access the first element of the array at that index and see if it equals a newline.
    How do i do that?

    I was thinking to perhaps print out every character in the horizontal array and then doing the skip down to the next array, but i tried that and it failed miserably.

    The only thing i can see that will fix it is to check the first value of each horizontal array to see if its a '\n' character, and if it sees it, reassign that position with a '\0', but i didnt know how to do that, i was hoping you may be able to shed some light on that...

    thanks

  10. #10
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    if( array[x][0] == '\n' )
        printf("Skip this line or end here.\n");
    Just like that.

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

  11. #11
    Registered User
    Join Date
    Apr 2003
    Posts
    4
    OK, that solution worked fine for what I am doing... but now when I'm trying to put it all into practice in my real assignment, it's not working right. Here is what the assignment is supposed to do.

    There are a series of functions that process different parts of the data (student ID numbers and grades) and we are supposed to replace the array being passed with pointer notation... AKA we go from this function declaration....
    Code:
    void printStudentScoresAndAverage (
    const unsigned short theScores /*this is the array*/,
    blah blah);
    to this
    Code:
    void printStudentScoresAndAverage (
    const unsigned short *theScores /*this is the pointer to the array*/,
    blah blah);
    Problem is, I keep getting a segmentation fault when I try and actually print everything out. Here is the full code of the assignment (warning, its really really long but the part where its dying is the function in the example above). If anyone has any input I would be very greatful!!! thanks.
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    #include "courses.h"
    
    
    /*Here is printTableTitle's prototype*/
    void printTableTitle( const char *theTitle );
    
    /*Here is printColumnLable's prototype*/
    void printColumnLabels( unsigned short quiz_count );
    
    /*Here is calculateStudentAverage's prototype*/
    float calculateStudentAverage(
          unsigned short **theScores,
          unsigned short studentRoNumber,
          unsigned short totalRowsInArray,
          unsigned short totalColumnsInArray,
          unsigned short valCount);
    
    /*Here is printStudentScoresAndAverage's prototype*/
    
    void printStudentScoresAndAverage(
      const unsigned short **theScores,
      unsigned short studentid[TOTAL_ROWS],
      unsigned short studentRoNumber,
      unsigned short totalRowsInArray,
      unsigned short totalColumnsInArray,
      unsigned short valCount);
    
    /*Here is calculateQuizAverage's prototype*/
    
        float calculateQuizAverage(
           const unsigned short **theScores,
           unsigned short quizColumnNumber,
           unsigned short totalRowsInArray,
           unsigned short totalColumnsInArray,
           unsigned short valCount);
    
    /*Here is printQuizAverages prototype*/
    
    void printQuizAverages(
           const unsigned short **theScores,
           unsigned short totalRowsInArray,
           unsigned short totalColumnsInArray,
           unsigned short studentCount,
           unsigned short quizCount );
    
    
    /*We begin the definitions of all functions here*/
    
    
    /**********************************************************************************************
    printTableTitle()
    
    Description: Function to display the title of the table being printed
    
    Returns: NONE
    
    Parameters:
    
    theTitle[]: Contains the title for the array being printed. Not modifyable.
    
    Procedure/Algorithm: Uses a printf statement to print the array's title (specified by theTitle[])
    ************************************************************************************************/
    
    
    void printTableTitle( const char *theTitle)
    {
      printf ("\n%s", theTitle);
    }
    
    
    
    
    /************************************************************************************************
    printColumnLabels()
    
    Description: Function to print the column labels on the array.
    
    Returns: NONE
    
    Parameters:
    quiz_count: acts as a placeholder for the column label value (i.e. 1, 2, 3, ect.)
    
    Procedure/Algorithm: Uses a for loop in order to print labels on each students quiz score row.
    
    *************************************************************************************************/
    
    void printColumnLabels(unsigned short quiz_count )
    {    
      int variable;
     
      printf ("\n\n%10s", "Student");
      for (variable = 1; variable <= quiz_count; variable++)
        {
          printf("%5d",variable);
        }   
      printf("%10s\n", "Average");
    }
    
    
    /************************************************************************************************
    calculateStudentAverage()
    
    Description: Function that calculates the students quiz adverage for a single row.
    
    Returns:
    
    average = the average calculated by the function
    
    Parameters:
    theScores [][TOTAL_COLUMNS]: Array that stores students test scores.
    studentRoNumber: Current row number that the function is currently working with.
    totalRowsInArray: The total number of rows in our student grades array
    totalColumnsInArray: The total number of columns (tests) in the array.
    valCount: total number of filled columns in the student array.
    
    Procedure/Algorithm: The function takes a single row of student quiz scores,
    adds them up and then calculates their average.
    **************************************************************************************************/
    float calculateStudentAverage(
          unsigned short **theScores,
          unsigned short studentRoNumber,
          unsigned short totalRowsInArray,
          unsigned short totalColumnsInArray,
          unsigned short valCount)
    {   
      float rowAverage;
      unsigned short ColumnsInArray;
      rowAverage = 0;
     
    
      for (ColumnsInArray = 0; ColumnsInArray < valCount; ColumnsInArray++)
        {
          rowAverage += theScores[studentRoNumber][totalColumnsInArray]; 
        }
      rowAverage /= (float) valCount;
     
      totalColumnsInArray == ColumnsInArray;
      return rowAverage;
    }
    
    
    /***********************************************************************************************************
    printStudentScoresAndAverage()
    
    Description: Function that prints out the previously calculated student scores and averages
    
    Returns: NONE - simply prints out results
    
    Parameters:
    theScores: Array that stores the list of student test scores.
    studentRoNumber: Current row number that the function is currently working with.
    totalRowsInArray: The total number of rows in our student grades array.
    totalColumnsInArray: The total number of columns (tests) in the array.
    valCount: Number of filled columns in the student grades array.
    
    Procedure/Algorithm: Input from main() is taken and put into the function. The function prints out
    the unadulterated test scores. Once they are fully printed, the function calls the calculateStudentAdverage
    function and prints out the student's average on the test scores.
    ************************************************************************************************************/
    
    void printStudentScoresAndAverage(
      const unsigned short **theScores,
      unsigned short studentid[TOTAL_ROWS],
      unsigned short studentRoNumber,
      unsigned short totalRowsInArray,
      unsigned short totalColumnsInArray,
      unsigned short valCount)
    {
      unsigned short ColumnsInArray;
    
     printf ("%10.03hu", studentid[studentRoNumber]);
     
      for (totalColumnsInArray = 0; totalColumnsInArray < valCount; totalColumnsInArray++)
        {
          printf("%5hu", theScores[studentRoNumber][totalColumnsInArray]);
        }
      printf("%10.2f\n", calculateStudentAverage(theScores, studentRoNumber, totalRowsInArray, totalColumnsInArray, valCount));
    }
    
     
      /***************************************************************************************************************
    calculateQuizAverage()
    
    Description: Function that calculates averages for all quizzes in a column
    
    Returns:
    quizAverage = average for the quiz column at hand
    
    Parameters:
    theScores: Array that stores the list of student test scores.
    quizColumnNumber: Value sent from printQuizAverages() - indicates current column
    totalRowsInArray: The total number of filled rows in our students grade array
    totalColumnsInArray: The total number of columns (tests) in the array.
    valCount: number of filled columns in the student grades array.
    
    Procedure/Algorithm: Input from printQuizAverages() is sent to the function. Function then calculates the
    average for all tests in a particular test column and sends results back to printQuizAverages() as quizAverage.
    ****************************************************************************************************************/
    
    float calculateQuizAverage(
       const unsigned short **theScores,
       unsigned short quizColumnNumber,
       unsigned short totalRowsInArray,
       unsigned short totalColumnsInArray,
       unsigned short valCount)
    {
      float quizAverage;
      quizAverage = 0.0;
      for (totalRowsInArray = 0; totalRowsInArray <= valCount; totalRowsInArray++)
        {
          quizAverage += theScores[totalRowsInArray][quizColumnNumber];
        }
      quizAverage /= valCount;
     
      return quizAverage;
    }
     
    
    /**********************************************************************************************************
    printQuizAverages()
    
    Description: Function that prints out quiz averages calculated by calculateQuizAverage()
    
    Returns: None - prints outputquizColumnNumber
    
    Parameters
    theScores: Array that stores the list of student test scores.
    totalRowsInArray: The total number of filled rows in our students grade array
    totalColumnsInArray: The total number of columns (tests) in the array.
    studentCount: Number of filled rows in our student grades array.
    quizCount: Number of filled columns in our student grades array.
    
    Procedure/Algorithm: Function executes after main body of program (introduction, printing of student grades)
    has completed. Function takes input from main() and utilizes seperate function calculateQuizAverage() to
    calculate the adverages for each quiz column. It then prints these at the bottom of the quiz array.
    ************************************************************************************************************/
    
    void printQuizAverages(
           const unsigned short **theScores,
           unsigned short totalRowsInArray,
           unsigned short totalColumnsInArray,
           unsigned short studentCount,
           unsigned short quizCount)
    {
      float quizaverage; //Value used to pass the average without changing value of quizCount
      unsigned short incrementalvalue; //Value used in for loop below to advance the column to be printed
     
      printf( "%10s", "Average" ); 
      for (incrementalvalue = 0; incrementalvalue < quizCount; incrementalvalue++)
        {
          printf ("%5.1f",  calculateQuizAverage(theScores, incrementalvalue, studentCount, quizCount, studentCount));
        }
      quizaverage = 0.0f;
     
      for (incrementalvalue = 0; incrementalvalue <= studentCount; incrementalvalue++)
        quizaverage += calculateQuizAverage(theScores, incrementalvalue, studentCount, quizCount, studentCount);
     
      quizaverage /= quizCount;
      printf("%10.2f", quizaverage);
    }
    
    /************************************************************************************************
    CourseCreateCourse()
    
    Description: Function that creates a new structure of type Class_t to hold course info
    
    Returns: One, returns structure "newcourse"
    
    Parameters:
    coursename - Array that holds the name of the course.
    deptnum - The department number of the course in question.
    coursenum - The course number of the course in question.
    sectionnum - The section number of the course in question.
    
    Procedure/Algorithm: The function is sent info from main reguarding the course name, and
    numbers. The function initializes the structure for the course and inserts this data into it.
    The data that is not added at the time of initialization, such as student numbers, is set to 0.
    The function then returns the structure to main.
    ************************************************************************************************/
    
    //CourseCreateCourse starts here
    Class_t CourseCreateCourse(
    char coursename[25],
    unsigned short deptnum,
    unsigned short coursenum,
    unsigned short sectionnum
    )
    {
      Class_t  newcourse = { 0 };
      int i, j;
      unsigned short **quizzesp;
     
      //Copies the char array of coursename to the structure elements
      strcpy(newcourse.coursename, coursename);
     
      //Copies the various numbers to the structure elements
      newcourse.deptnum = deptnum;
      newcourse.coursenum = coursenum;
      newcourse.sectionnum = sectionnum;
      quizzesp = (unsigned short**) calloc (sizeof (unsigned short), TOTAL_ROWS);
      for (i = 0; i <= TOTAL_ROWS; i++)
        quizzesp[i] = (unsigned short*) calloc (sizeof (unsigned short), TOTAL_COLUMNS);
     
      quizzesp = &newcourse.quizzes;
      //Returns structure.
      return newcourse;
    }
     
    /*************************************************************************************************
    CourseAddStudent()
    
    Description: Adds a student to the array elements of structure newcourse, repeating until the
                 user-defined counter is complete
    
    Returns: Updated version of the newcourse structure with student info within.
    
    Parameters:
    newcourse - Structure occurance from main that was from CourseCreateCourse.
    
    Procedure: Based on the number of students that was entered by the user, CourseAddStudent runs a
    for loop that asks for various student and quiz related information. It takes this information and stores it within the newcourse structure. At the same time, it keeps track of how many quizzes
    there are and enters that info into newcourse as well. Once completed, it returns the updated
    structure value to main.
    *************************************************************************************************/
    
    //CourseAddStudent Starts here
    Class_t CourseAddStudent(Class_t newcourse)
    {
      unsigned short counter;
     
      unsigned short  studentquiz = 0;
     
     
      //Start of student-adding loop
     
      printf("\nPlease enter the student's ID number now:");
      scanf("%hu", &newcourse.studentid[counter]);
     
      //Start of sub-loop to add student's quiz scores.
      while(studentquiz < newcourse.scorecount)
        {
          printf("\nPlease enter the student's quiz score %hu:", studentquiz+1);
          scanf("%hu", &newcourse.quizzes[counter][studentquiz]);
          studentquiz++;
        }
     
      studentquiz = 0;
    
    
      //Return newcourse to main.
      return newcourse;
    } 
    
    /*************************************************************************************************
     CourseAddScore()
    
    Description: Function that adds the final quiz score onto the end of the array for each student
    
    Returns: Updated version of the newcourse structure occurance
    
    Parameters:
    newcourse - Structure occurance sent from main.
    
    Procedure: The function adds one last test to the end of each student row. This enables the user
    to have one last grade added before the adverages are calculated. Once the grade is added, the
    newcourse.scorecount value is updated to reflect the extra score, and the function returns the
    updated version of the newcourse structure occurance.
    *************************************************************************************************/
    
    //CourseAddScore Begins here
    Class_t CourseAddScore(Class_t  newcourse)
    {
      unsigned short student;
     
      //Run down the list of students to add the extra grade
      for (student = 0; student < newcourse.studentcount; student++)
        {
          printf("\nPlease enter the quiz score for student %hu:", student+1);
          scanf("%hu", &newcourse.quizzes[student][newcourse.scorecount]);
        }
      //Update the scorecount value
      newcourse.scorecount++;
      return newcourse;
    }
    
    
    /*************************************************************************************************
    CoursePrintScores()
    
    Description: Function that handles the printing of the table title, the student numbers, the
    student grades, and the adverages to everything.
    
    Returns: NONE
    
    Parameters:
    newcourse - Structure occurance sent from main.
    
    Procedure: This function is responsible for printing all of the scores and averages, plus the
    table title. It does this with the existing functions printTableTitle, printColumnLables,
    printStudentScoresAndAverage, and printQuizAverages. The function sends the data to these various
    functions in the order that the require, having broken the structure down to its component parts.
    *************************************************************************************************/
    
    //CoursePrintScores
    Class_t CoursePrintScores(Class_t newcourse)
    {
      unsigned short i;
    
      //Print the table title
      printTableTitle(newcourse.coursename); 
    
      //Print the quiz numbers
      printColumnLabels(newcourse.scorecount);
    
      //Print the student scores and adverage for each student
      for (i = 0; i < newcourse.studentcount; i++)
        printStudentScoresAndAverage(newcourse.quizzes, newcourse.studentid, i, newcourse.studentcount, newcourse.scorecount, newcourse.scorecount);
    
      //Print the quiz adverages
      printQuizAverages(newcourse.quizzes, TOTAL_ROWS, TOTAL_COLUMNS, newcourse.studentcount, newcourse.scorecount);
      printf("\n");
    
    }
    
    /*Start of main function*/
    int main( void )
    {
    /*   *************************************************************************
         * DEFINE arrays:                                                        *
         ************************************************************************/
      unsigned short deptnum, coursenum, sectionnum, counter, quizcount, i;
      char coursename[25],tempcoursename1[25], tempcoursename2[25];
     
     
      //Initialization of the newcourse structure.
      Class_t newcourse;
    
      /*************************************************************************
       * PRINT Introduction to user                                            *
       ************************************************************************/
      printf("Please specify a Course Name:");
      scanf ("%s %s", tempcoursename1, tempcoursename2);
    
      //Appending the 2nd part of the course name onto the same array
      strcat(tempcoursename1, " ");
      strcat(tempcoursename1, tempcoursename2);
    
      printf("\nPlease enter the Department number:");
      scanf ("%hu", &deptnum);
     
      printf("\nPlease enter the Course number:");
      scanf ("%hu", &coursenum);
    
      printf("\nPlease enter the Section number:");
      scanf("%hu", &sectionnum);
    
      //Defining how the title will be printed through sprintf
      sprintf(coursename, "%s # %hu.%hu-%.03hu", tempcoursename1, deptnum, coursenum, sectionnum);
    
     
      //Execute CourseCreateCourse
      newcourse = CourseCreateCourse(coursename, deptnum, coursenum, sectionnum);
     
      //More User prompts
      printf("\nPlease enter the number of students in the course:");
      scanf("%hu", &newcourse.studentcount);
     
      printf("\nNow you will be allowed to enter in your students and their scores.");
     
      //Begin student-adding loop.
    
      for (counter = 0; counter < newcourse.studentcount; counter++)
        {
      printf("\nPlease enter the number of quiz scores:");
      scanf("%hu", &quizcount);
    
      //If the number of quizzes is greater than that currently on file...
      if(quizcount >= newcourse.scorecount)
        //newcourse.scorecount gets updated
        newcourse.scorecount = quizcount;
      else
        quizcount = 0;
    
      //Execute CourseAddStudent
      newcourse = CourseAddStudent(newcourse);
      }
     
      printf("\nNow you will be allowed to enter the student's final quiz score.");
     
      //Execute CourseAddScore
      newcourse = CourseAddScore(newcourse);
    
      //Execute CoursePrintScores
      newcourse = CoursePrintScores(newcourse);
    
     
      return EXIT_SUCCESS;
    }
    Thanks to anyone who feels like reading through this beast :-)

    skybolt_1

  12. #12
    Registered User
    Join Date
    Apr 2003
    Posts
    4
    Sorry - Here is the header file. BTW what is a good debugger to use in Linux? I am using the cc compiler and emacs right now.

    Code:
    //Define constants
    #define TOTAL_COLUMNS 15
    #define TOTAL_ROWS 35
    
    
    //define struture type
    typedef  struct
    {
      char coursename [25];
      unsigned short deptnum;
      unsigned short coursenum;
      unsigned short sectionnum;
      unsigned short studentid[TOTAL_ROWS];
      unsigned short quizzes[TOTAL_ROWS][TOTAL_COLUMNS];
      unsigned short scorecount;
      unsigned short studentcount;
    } Class_t;
    
    //Define CourseCreateCourse
    Class_t CourseCreateCourse(
    char coursename[25],
    unsigned short deptnum,
    unsigned short coursenum,
    unsigned short sectionnum
    );
    
    //Define CourseAddStudent
    Class_t CourseAddStudent(Class_t);
    
    //Define CourseAddScore
    Class_t CourseAddScore(Class_t);
    
    //Define CoursePrintScores
    Class_t CoursePrintScores(Class_t);
    Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pointers & arrays and realloc!
    By zesty in forum C Programming
    Replies: 14
    Last Post: 01-19-2008, 04:24 PM
  2. Pointers and multi dimensional arrays
    By andrea72 in forum C++ Programming
    Replies: 5
    Last Post: 01-23-2007, 04:49 PM
  3. Passing pointers to arrays of char arrays
    By bobthebullet990 in forum C Programming
    Replies: 5
    Last Post: 03-31-2006, 05:31 AM
  4. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  5. Help understanding arrays and pointers
    By James00 in forum C Programming
    Replies: 2
    Last Post: 05-27-2003, 02:41 AM

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