vendredi 27 mars 2015

conflicting type for funct in C



Iam trying to run the below code and iam getting below error msg-


Program:-



int main()
{
int (*res)[3],i;
res=func();


}

int (*func())[3]
{
static int arr[3][3]={1,2,3,4,5,6,7,8,9};
return arr;
}


Error:



PointerTo1D.c: In function ‘main’:
PointerTo1D.c:6:5: warning: assignment makes pointer from integer without a cast [enabled by default]
res=func();
^
PointerTo1D.c: At top level:
PointerTo1D.c:11:7: error: conflicting types for ‘func’
int (*func())[3]
^


PointerTo1D.c:6:6: note: previous implicit declaration of ‘func’ was here res=func();


Could someone please help me out here???




Aucun commentaire:

Enregistrer un commentaire