Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I use a structure?
    primarykey
    data
    text
    <p>Ok firstly I'll explain my assignment. For this assignment I have to use dynamic memory allocation which I am having no problems with. What I am having a problem with is figuring out the correct way to work my assignment. For my assignment I need to create a program that prompt the user to enter how many students they have then ask for the following information; Student ID, Birthdate, and Phone number. I need to use a loop to prompt the user to enter all the students information. I need to create a loop that will scan through all the student IDs and find the oldest student using their birthdate (The loop must be able scan through more then 3 students).</p> <p>Here is my code, I've gotten some suggestions and even bits of code from you guys, but after implementing them I'm even more confused on what I should do. Please take a look at it and critique me. </p> <p>EDIT: I also added in on the code where I'm receiving and error</p> <p>Thank you.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main (void) { int * studentData= NULL; int * studentDataType=NULL; int students; int studentID; int year; int month; int day; long long phone; printf("How many students are you entering records for:\n"); scanf("%d", &amp;students); studentData=(int*)malloc((sizeof(int)*students)); struct studentDataType { int studentID; int year; int month; int day; long long phone; }; //invalid operands to binary * (have 'int' and 'int *') studentDataType *studentData = (studentDataType*)malloc(numberOfStudents *sizeof(studentData)); for (int i = 0 ; i &lt; students ; ++i) { printf("%d, %d, %d, %d, %d\n", studentID, year, month, day, phone); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload