please only c code dont use c++ and c#. * Function: write the compare_restaurants_ascending function according to the given parameters. #include #include #include #define N 2000 #define D 250 // A simple restaurant structure typedef struct { char restaurant_name[15]; double rating; char city[31]; unsigned short opening_year; } RESTAURANT_t, *RESTAURANT; // Arraylist structure typedef struct ArrayList_s { void **list; int size; int capacity; int delta_capacity; } ArrayList_t, *ArrayList; *Function: compare_restaurants_ascending * This function compares given restaurants with respect to first their ratings and then their names. It returns - 1, if rest1 > rest2 - -1, if rest1 < rest2 - 0, if rest1 = rest2 */ int compare_restaurants_ascending(void *rest1, void *rest2) { // TODO: Fill this block. }
please only c code dont use c++ and c#. * Function: write the compare_restaurants_ascending function according to the given parameters.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 2000
#define D 250
// A simple restaurant structure
typedef struct
{
char restaurant_name[15];
double rating;
char city[31];
unsigned short opening_year;
} RESTAURANT_t, *RESTAURANT;
// Arraylist structure
typedef struct ArrayList_s
{
void **list;
int size;
int capacity;
int delta_capacity;
} ArrayList_t, *ArrayList;
*Function: compare_restaurants_ascending
* This function compares given restaurants with respect to first their ratings and then their names. It returns
- 1, if rest1 > rest2
- -1, if rest1 < rest2
- 0, if rest1 = rest2
*/
int compare_restaurants_ascending(void *rest1, void *rest2)
{
// TODO: Fill this block.
}
Step by step
Solved in 2 steps