Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How would I create this C program? Not C++. I\'m not familiar with double pointe

ID: 3897747 • Letter: H

Question

How would I create this C program? Not C++. I'm not familiar with double pointers before the end ot the lab USINU zero, no exceptions H?PROC ESS HE A GIVES YOU. Not doing so WILL result in a Description: For the lab assignment you are given information about students in a class (name, ID and GPA) and you need to compute a few statistics (max, min and average GPA) about the students and perform some linear search operation. All the students' information is stored in an input file. Below is the input file for the lab assignment. It has the number of students (first line), student's name, ID (5 digits) and GPA (a float). John 12345 3.5 Beth 12345 3.2 Murphy 57465 4.0 Donald 88888 3.8 The first entry in the file is the size of the input. Implement the following functions for the lab assignment. int read info(char, int*, char foat): It takes four arguments, input file names (char ) and three arrays of type int char and float to store the student ID, name and GPA respectively First open the input file using the file name provided by the user (from the command line). As mentioned earlier, the first line of the file is the size of the input. Read that number to run a loop. In a loop read information for each student and store them in the three arrays passed to function ( int, char and float array). Close the input file after the use. At the end the function returns the size of the input. This function

Explanation / Answer

Note : Just give some time..I can complete it.Thank You

________________

#include <stdio.h>

#include <math.h>

#include <stdlib.h>

#include <string.h>

int read_info(char*,int*,char**,float*);

void print_array(int*,char**,float*,int);

int main ()

{

//Declaring variables

FILE *f1;

char filename[30]="studentsInfo.txt";

int size;

//Opening the output file in read mode

f1 = fopen(filename,"r");

  

if(f1 == NULL)

{

printf("** File not found **");

exit(1);

}   

else

{

fscanf(f1,"%d",&size);

//closing the files

fclose(f1);

char **names;

names = malloc(sizeof(char*) * size);

  

float gpa[size];

int id[size];

int n=read_info(filename,id,names,gpa);

  

print_array(id,names,gpa,n);

  

  

}

return 0;

}

int read_info(char* filename,int* id,char** names,float* gpa)

{

int count=0,size;

int ch=0;

FILE *f1;

f1 = fopen(filename,"r");

fscanf(f1,"%d",&size);

while (fscanf(f1, "%s",names[count]) == 1)

{

fscanf(f1,"%d%f",&id[count],&gpa[count]);

printf("%s %d ",names[count],id[count]);

if (ch == ' ')

{

count++;

}

}

//closing the files

fclose(f1);

  

return count;

}

void print_array(int* id,char** names,float* gpa,int n)

{

int i;

for(i=0;i<n;i++)

{

printf("jhi");

}

  

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote