0
Good morning everyone, I wish in my code to leave the Main(); only with calling functions, all work is divided into small functions in the document.
I want to write a matrix[3][3] in a function and organize and print in other distinct functions. My code aims to transpose a matrix, I believe my logic is correct, using Bubble Sort but the parameter passage is not working properly since I am using pass by value and no reference...
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
void receberMatriz(int matriz[3][3])
{
    int i, j;
    for(i = 0; i < 3; i++)
    {
        for(j = 0; j < 3; j++)
        {
            printf("Insira o valor de [%i][%i]: ", i, j);
            scanf("%i", &matriz[i][j]);
        }
    }
}
void organizarMatriz(int matriz[3][3])
{
    int i, j, aux;
    for(i = 0; i < 3; i++)
    {
        for(j = 0; j < 3; j++)
        {
            aux = matriz[i][j];
            matriz[i][j] = matriz[j][i];
            matriz[j][i] = aux;
        }
    }
}
void imprimirMatriz(int matriz[3][3])
{
    int i, j;
    for(i = 0; i < 3; i++)
    {
        for(j = 0; j < 3; j++)
        {
            printf("[%i][%i]", i, j);
        }
        printf("\n");
    }
}
    int main(void)
    {
        int matriz[3][3];
        receberMatriz(matriz);
        imprimirMatriz(matriz);
        //organizarMatriz(matriz); desabilitei chamada para testar valores recebidos e impressos pela matriz. 
        return 0;
    }
How can I work with passing parameters of a matrix by reference? In other words, pointers...?
There seems to be only logic error: https://ideone.com/cBUnXo
– Maniero
Really, after your comment I looked at the code more carefully, thank you very much master!!!
– Lelre Ferreira