1
The intention in this program would be to print the position linha and coluna where the highest value is located within the matrix, someone can tell me why the result is printing 0x0 and if there is another way more effective? In my test of course, the higher value typed was not the first.
#include<stdio.h>
#include<stdlib.h>
int matriz[3][3],i,j,maior=0,i1,j1;
main(){
for(i=0;i<3;i++){
for(j=0;j<3;j++){
printf("Digite um valor: ");
scanf("%d",&maior);
if(matriz[i][j]>maior){
maior=matriz[i][j];
i1=i;
j1=j;
}//fim if
}//fim for j
}//fim for i
printf("%d x %d \n",i1,j1);
system("pause");
}//fim do main
Your matrix is not initialized anywhere.
– Beterraba