2-WK05StructArray.c - Name Cameron Gray Section JJ Date...

Info icon This preview shows pages 1–2. Sign up to view the full content.

/********************************************************************** Name: Cameron Gray Section: JJ Date: 2018-02-14 Description: Structures: - Structure array - Structure with member array - Member access - Setting member values **********************************************************************/ #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #define MAXSTUDENTS 10 // Literal constant for maximum students in the array #define MAXGRADES 5 // Literal constant for maximum grades // Derived type declared struct Student { int studentID; int semester; float grade; }; int main(void) { int i; /*------------------------------------------------------------------------------ --------------*/ // 1. Array of structures! struct Student sectionJJ[MAXSTUDENTS] = { { 5001, 1, 70.1f }, // Student 1, Element: 0 { 5002, 1, 60.2f }, // Student 2, Element: 1 { 5003, 1, 50.3f }, // Student 3, Element: 2 { 5004, 1, 40.4f }, // Student 4, Element: 3 { 5005, 1, 30.5f } }; // Student 5, Element: 4 // Display students array printf("Student ID Semester Grade\n"); printf("---------- -------- -----\n"); for (i = 0; i < MAXSTUDENTS; i++) { // The below line is fine... but for demonstration purposes see below for more readable format //printf("%-10d %8d %5.1f\n", sectionJJ[i].studentID, sectionJJ[i].semester, sectionJJ[i].grade);
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 2
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '16
  • scanf, printf, Cameron Gray

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern