# Compiling Warning

• 06-29-2011
Micki-Zee
Compiling Warning
Can someone please help me? When I compile the code, the line where I call the function gives me a warning, saying: 'Passing argument 1 from incompatible pointer type.' I have no idea how to fix it!!

Code:

```#include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #define N 3 int find_inner_product (int *a,int *b,int size)         {int inner_product=0,i=0;         for (i=0;i<size;i++)                                 {inner_product+=*(a+i)*(*b+i);}                         return inner_product;} /*function to do the inner product*/ int i=0,j=0,row_number,column,inner_product; int main() {         int matrix1[N][N],matrix2[N][N];                         printf("Please enter the values of the 3x3 Matrix: ");                 for        ( i = 0; i < N; i++ )                 {for( j = 0;  j< N; j++ )                                 {scanf("%d", &matrix1[i][j]);}                 } /*this for loop goes through every number and stores it in the first matrix*/                         printf("\nPlease enter the values of the second 3x3 Matrix: ");                 for        ( i = 0; i < N; i++ )                 {for( j = 0;  j< N; j++ )                                 {scanf("%d", &matrix2[i][j]);}                 } /*this for loop goes through every number and stores it in the second matrix*/                 find_inner_product(matrix1, matrix2, N)         printf("%d", inner_product);                 } }```
• 06-29-2011
CommonTater
Code:

```#include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #define N 3 int find_inner_product (int *a,int *b,int size)         {int inner_product=0,i=0;         for (i=0;i<size;i++)                                 {inner_product+=*(a+i)*(*b+i);}                         return inner_product;} /*function to do the inner product*/ int i=0,j=0,row_number,column,inner_product;    <---- move this inside main int main()          <--- the correct form is ... int main (void) {         int matrix1[N][N],matrix2[N][N];                         printf("Please enter the values of the 3x3 Matrix: ");                 for        ( i = 0; i < N; i++ )                 {for( j = 0;  j< N; j++ )                                 {scanf("%d", &matrix1[i][j]);}                 } /*this for loop goes through every number and stores it in the first matrix*/                         printf("\nPlease enter the values of the second 3x3 Matrix: ");                 for        ( i = 0; i < N; i++ )                 {for( j = 0;  j< N; j++ )                                 {scanf("%d", &matrix2[i][j]);}                 } /*this for loop goes through every number and stores it in the second matrix*/                 inner_product = find_inner_product(matrix1, matrix2, N);                     printf("%d", inner_product);                 return 0;  <--- main always returns an integer value } }```
[/QUOTE]
• 06-29-2011
Micki-Zee
Im still not getting the answer I should be. I need the dot product of the first line of the matrix and its not correct with my current code:confused:
• 06-29-2011
Micki-Zee
Nevermind, problem solved