I need to write a code that will to this: You enter names and first names and a grade. Only for the grade >= 10, you print the names and firstname of the student with a backward sort. Exemple:
Bob Dylan 12 Robert Patt 9 Chris Strozy 15 Josh Sta 11
will give :
Chris Strozy 15 Bob Dylan 12 Josh Sta 11.
My errors are on the strcpy lines :
too few arguments to function 'strncpy'| assing argument 1 of 'strncpy' makes pointer from integer without a cast
char tab_nom[N][M] ;
char tab_prenom[N][M] ;
float tab_notes[N];
char tmp_n, tmp_p;
int i,j,tmp;
for (i=0;i<N;i++)
{
printf("Saisissez le nom %d :", i+1);
scanf("%s",tab_nom[i]);
printf("Saisissez le prenom %d :", i+1);
scanf("%s",tab_prenom[i]);
printf("Saisissez la note %d :", i+1);
scanf("%f",&tab_notes[i]);
}
for (i=0;i<N;i++)
{
for(j=0; j< N-1 ; j++)
{
if (tab_notes[j] < tab_notes[j+1])
{
tmp=tab_notes[j];
tab_notes[j]=tab_notes[j+1];
tab_notes[j+1]=tmp;
strcpy(tmp_n,tab_nom[j]);
strcpy(tab_nom[j],tab_nom[j+1]);
strcpy(tab_nom[j+1],tmp_n);
strcpy(tmp_p,tab_prenom[j]);
strcpy(tab_prenom[j],tab_prenom[j+1]);
strcpy(tab_prenom[j+1],tmp_p);
}
}
}