O
octavio
Hello members of the comp.lang.c newsgroup. Please I need you help on
the following one.
Compiling the simple code I'm getting this error message.
Why ? Please what's the correct type of the fb function ?
Thank You.
Octavio
and.c:15: attention : type mismatch with previous implicit declaration
and.c:11: attention : previous implicit declaration of `fb'
and.c:15: attention : « fb » a été précédemment déclaré
implicitement comme retournant un « int »
and.c: Dans la fonction « fb »:
and.c:34: attention : function returns address of local variable
#include<stdio.h>
int main (void){
int taille = 5;
int a[5]={1,1,0,0,0};/*tableaux de test*/
int b[5]={1,0,1,0,0};
int *r; int i;
int op=0;
*r=fb(a,b,taille,op);
}
int * fb(int a[5],int b[5],int taille,int op){
int mat_and[2][2]={0,0,0,1};
int i;
int res[taille]; /*res c'est le tableau résultat */
switch(op)
{
case 0:
{ /*opération AND colonne par colonne des 2 vecteurs */
for(i=0; i<taille; i++){
res=mat_and[a][b];
}
break;
}
} //switch end
return res;
}
the following one.
Compiling the simple code I'm getting this error message.
Why ? Please what's the correct type of the fb function ?
Thank You.
Octavio
and.c:15: attention : type mismatch with previous implicit declaration
and.c:11: attention : previous implicit declaration of `fb'
and.c:15: attention : « fb » a été précédemment déclaré
implicitement comme retournant un « int »
and.c: Dans la fonction « fb »:
and.c:34: attention : function returns address of local variable
#include<stdio.h>
int main (void){
int taille = 5;
int a[5]={1,1,0,0,0};/*tableaux de test*/
int b[5]={1,0,1,0,0};
int *r; int i;
int op=0;
*r=fb(a,b,taille,op);
}
int * fb(int a[5],int b[5],int taille,int op){
int mat_and[2][2]={0,0,0,1};
int i;
int res[taille]; /*res c'est le tableau résultat */
switch(op)
{
case 0:
{ /*opération AND colonne par colonne des 2 vecteurs */
for(i=0; i<taille; i++){
res=mat_and[a][b];
}
break;
}
} //switch end
return res;
}