system_eyes
hi friends, i was solving some exercises with c (making revision)then i write this program but the problem that there were an errors duraing the compilation, i wonder if some one can correct me, the program is to determine the smallest value in the multible subscripted array
thanks
#include <stdio.h>
#include <conio.h>
void sort1 (int[][5]);
void sort2 (int[][5]);
void getsmall (int,int);
int main()
{
int t[2][5] = { {2,3,2,1,0} , {9,3,4,32,2} } ;
sort1(t);
sort2(t);
getsmall(t[0][0],t[1][0]);
return 0;
getch();
}
void sort1 (int b[][5])
{
int hold = 0 ;
for(i= 0 ,i != 4 ,i++ )
for(j=0,j!=4,j++)
if(b[0][j] > b[0][j+1]){
hold = b[0][j];
b[0][j] = b[0][j+1];
b[0][j+1] = hold;
}
}
void sort2 (int b[][5])
{
int hold = 0 ;int j;int i;
for(i= 0,i!= 4,i++)
for(j=0,j!=4,j++)
if(b[1][j] > b[1][j+1]){
hold = b[1][j];
b[1][j] = b[1][j+1];
b[1][j+1] = hold;
}
}
void small(int a,int b)
{
int small = 0;
if(a > b)
small = b;
else
small = a;
printf("the smallest value is %d",small);
}
thanks
#include <stdio.h>
#include <conio.h>
void sort1 (int[][5]);
void sort2 (int[][5]);
void getsmall (int,int);
int main()
{
int t[2][5] = { {2,3,2,1,0} , {9,3,4,32,2} } ;
sort1(t);
sort2(t);
getsmall(t[0][0],t[1][0]);
return 0;
getch();
}
void sort1 (int b[][5])
{
int hold = 0 ;
for(i= 0 ,i != 4 ,i++ )
for(j=0,j!=4,j++)
if(b[0][j] > b[0][j+1]){
hold = b[0][j];
b[0][j] = b[0][j+1];
b[0][j+1] = hold;
}
}
void sort2 (int b[][5])
{
int hold = 0 ;int j;int i;
for(i= 0,i!= 4,i++)
for(j=0,j!=4,j++)
if(b[1][j] > b[1][j+1]){
hold = b[1][j];
b[1][j] = b[1][j+1];
b[1][j+1] = hold;
}
}
void small(int a,int b)
{
int small = 0;
if(a > b)
small = b;
else
small = a;
printf("the smallest value is %d",small);
}