It tells me that there was an error. For me it's a problem of pointer or something about the structure, but I don't know exactly.
#include <stdio.h>
#include <stdlib.h>
#define MAX 100
typedef struct
{
char luogo[20];
float valore;
}rilevazione;
void BubbleSort(float valore[], int n);
int main()
{
int i=0, n=0, j=0;
rilevazione*dato=NULL;
dato=(rilevazione*)malloc(MAX*sizeof(rilevazione));
while(i<MAX)
{
printf("inserisci luogo %d: ", i+1);
scanf("%s", dato[i].luogo);
printf("inserisci valore %d: ", i+1);
scanf("%f", &dato[i].valore);
if(strcmp(dato[i].luogo, "end")==0) break;
i++;
}
n=i;
printf("il numero di misure e' %d", n);
scanf("%d", &n);
BubbleSort(dato.valore, n);
for(j=0; j<n; j++)
{
printf("valore: %d luogo: %s", dato[i].valore, dato[i].luogo);
}
return 0;
}
void BubbleSort(float valore[], int n)
{
int i=0, temp=0, j=0;
int scambi=1;
while(i<=n && scambi!=0)
{
scambi=0;
j=n;
while(j>=i)
{
if(valore[j]>valore[j+1])
{
temp=valore[j];
valore[j]=valore[j+1];
valore[j+1]=temp;
scambi=1;
}
j=j-1;
}
i=i+1;
}
return;
}