I wanted to know how to pass an array as a parameter where the user will type the order

Asked

Viewed 48 times

0

The code I had made is here. I set the max 5. Yeah, it’s the max of the exercise.

#include<stdio.h>
#include <stdlib.h>

#define MAX 5

void exibir(int num, int jogo[][MAX])
{
    int i, j;
    printf("\n");

    for(i = 0; i < num; i++)
    {
        for(j = 0; j < num; j++)
        {
            if(jogo[i][j] == 0)
                printf("    ");
            else
                if(jogo[i][j] == 1)
                    printf("  X ");
                else
                    printf("  O ");

            if(j != (num-1))
                printf("|");
        }
        printf("\n");
    }
    printf("\n");
}

main()
{
    int i, j, num;

    printf("Digite a ordem do jogo: ");
    scanf("%i", &num);

    int jogo[num][num];

    for(i = 0; i < num; i++)
    {
        for(j = 0; j < num; j++)
        {
            printf("%i\n", i);
            jogo[i][j] = 0;
        }
    }

    exibir(num, jogo);
}
  • do not understand what it means. Can post an example? What is "order" that the user will type?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.