Im trying to make a program that will sort the the list according to its cost...from least to expensive...

here's my code:

#include <stdio.h>
#include <string.h>

typedef struct resto RESTO;

struct resto{
       char *name;
       char *address;
       float cost;
       char *food;
void output(RESTO r1);
int main()
    RESTO r1= {"Coras","Agora",60,"BBQ"};
    RESTO r2= {"Panagatan","Opol",120,"BBQ"};
    RESTO r3= {"Max","Divisoria",70,"BBQ"};
    RESTO r4= {"XU Resto","Bukid",1200,"BBQ"};
    RESTO r5= {"Hubo2x","Eng'g Bldg. XU",6000,"BBQ"};  
    RESTO *ptr_r1 = &r1;

void output(RESTO r1)
     printf("Name: %s\n"
            "Addr: %s\n"
            "Cost: %.2f\n"

can u help me with this pls?

Make an array of the restaurant structures
Then sort according to the cost or what ever criteria that you want. You can use any of the common sorting algorithms for this
Only remember that each time that you swap, swap the entire structure and not just the cost