I’m trying to make a program in C, having a matrix and find if a number in a position is there, but I get the following errors:
[solved]
funcao.c:8:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
for(i=0; i=y; y++){
^
funcao.c:9:3: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
for(j=0;j=k; k++){
^
funcao.c:10:4: error: stray ‘\342’ in program
if(∗(∗(m+i)+j)==numero){
^
funcao.c:10:4: error: stray ‘\210’ in program
funcao.c:10:4: error: stray ‘\227’ in program
funcao.c:10:4: error: stray ‘\342’ in program
funcao.c:10:4: error: stray ‘\210’ in program
funcao.c:10:4: error: stray ‘\227’ in program
funcao.c:10:22: warning: comparison between pointer and integer [enabled by default]
if(∗(∗(m+i)+j)==numero){
^
make: *** [funcao.o] Error 1
And my code is this:
int find_matriz(int **m, int number, int y, int k) {
int find = 0;
int i, j;
for(i=0; i<y; y++) {
for(j=0; j<k; k++) {
if(*(*(m+i) + j) == number) {
find = 1;
}
}
}
return find;
}
I couldn't find anything on the web or here about matrix and this errors. How can I fix this?
[not solved]
I keep getting an error after I change the code:
make: *** [run] Segmentation fault
Main code:
int main(void) {
int m[5][2] = {{5,2}, {2,1}, {4,7}, {6,7}, {43,98}};
int y = 2;
int k = 1;
int number = 2;
int find = find_matriz(m, number, y, k);
printf("find %d\n", find);
return 0;
}