← Back to topics
Topic

[b]HELP PLEASE compiling error[/b]

n
nemisis
i wrote a program and when i compile it i get WARNING:passing arg 1 of ´matrica´ from incompatible pointer type!!
then program runs i input m and n, then i input the first element of matrix and then it crashes!


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

#define MAXRED 100
#define MAXSTUP 100

void matrica (int *m, int r, int s)
{
int i, j;
for(i=0;i<r;i++)
for(j=0;j<s;j++)
scanf("%d", *(m+(i*j)+j));
}

int main ()
{
int m, n, mat[MAXRED][MAXSTUP];
do {
printf("Unesite broj redaka m i broj stupaca n :\n");
scanf("%d %d", &m, &n);
} while (m<0||m>100||n<0||n>100);
int i, j;
printf("Unesite elemente matrice po retcima: \n");
matrica(&mat[0], m, n);
system("PAUSE");
return 0;
}
k
karakondzula
Try:

void matrica(int **m,int r, int s)
{}