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

Hello, please give me the code for this project in C Programming. Thank you. Car

ID: 3827441 • Letter: H

Question

Hello, please give me the code for this project in C Programming. Thank you.

CarInfo * findCar(CarInfo arr[], int size, unsigned int id) {

CarInfo *p = NULL; // ... return p;

}


This function should return a Pointer to the element in array arr that contains the car whose identification number is equal to the given argument id.

Car ID     Car Make     Car Model        Year     Unit Price Per Day       MPG
-----------------------------------------------------------------------------------------------------------------
311       Chevrolet    Chevelle-Malibu-1   2014       45.99               21
312       Buick        Skylark-320       2014       79.95               19
313       Plymouth    Satellite       2017       61.75               N/A
314       AMC       Rebel-SST       2016       99.99               16
315       Ford       Torino           2015       85.99               22.1
316       Ford       Galaxie-500       2016       61.95               29.5
317       Chevrolet   Impala           2013       42.99               18.7
318       Plymouth   Fury-iii       2017       69.85               20.52
319       Pontiac       Catalina       2012       29.99               N/A
320       AMC       Ambassador-DPL       2015       95.99               16.30
321       Citroen       DS-21-Pallas       2016       59.75               19.05

Explanation / Answer

/* Assuming "size" parameter denotes the size of the array */

CarInfo * findCar(CarInfo arr[], int size, unsigned int id) {
   int i = 0;
   CarInfo *p = NULL; // ... return p;

   for (i = 0; i<size; i++){
       if (arr[i].Car_ID == id){
          p = &arr[i];
          return p;
       }
   }
   return p;
}