Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The goal of this tutorial and assignment is to both motivate the use of heterogeneous aggregates (called structures in C) and introduce you to some

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

The goal of this tutorial and assignment is to both motivate the use of heterogeneous aggregates (called structures in C) and introduce you to some of the many ways they can be useful in programming. So, let's start with how one declares a structure in C. The code, struct studentData char lastName [30) char first Name [ 30 char idNum (91: int exam1 int exam2; int exam3 float avga char grade ) student: // makes a variable called student which is a struct with Freras as defined above. Each of the "fields" as they are called has a declaration like you've seen before. To access a field of a struct (student in this case) we use the So, if we wished to say that our hypothetical student received a 75 on exam 1, we could just do an assignment, such as student.examl 75; In fact, this might be a good time for you to copy all of the files (and directories) in the tutorial directory to one of your own. I'm sure you already know how to do this having been copying files all term long, but the "magic" command is: cp -r -dmk0080/public/1040/hwk/one/tutorial Make sure that you include both the (for recursive) and the ' at the end to indicate where to place the copy of that directory. If you have any questions at all about how this command works, ask someone, a TA or grader, or a peer mentor if one is available One of the files that you just copied is a C file, called simpleExample.c, which uses the very structure definition listed above. Look at the code to see how structure fields (of "student") are accessed in both the scanf and printf statements. At this point in the term your probably understand why some fields in the scanf include an & and others don't. But if not, ask someone. Go ahead and run the simpleExample.c program, but typing gcc simpleExample.c ./a.out

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

What is the total energy released in the decay n p + e- + e.

Answered: 1 week ago

Question

Dotazernion b. Ancant to inve b

Answered: 1 week ago

Question

consider how qualitative data can add value to your research;

Answered: 1 week ago

Question

consider the use of electronically obtained qualitative data;

Answered: 1 week ago