开发者

conflicting types for allocArray

guys I'm trying to compile my program in c but I'm getting this error (conflicting types for allocArray)?

Here is my code:

#include <stdio.h>
#include <stdlib.h>
int number(int);
char *allocArray(int);

int main ()
{
        printf("Enter a number: ");
        int userNumber;
        scanf("%d", &userNumber);
        int m= number(userNumber);
        printf("\nThe number is %d", m);
        printf("\n");

printf("*****************************************************\n");
        printf("The array is %s", alloArray(5));

}

int number(int n)
{

int num = n;

return num;
}

char *alloArray(int num)
{
        char *addr;
       开发者_JAVA百科 addr = (char *) malloc(num);
        //addr = char[num];
        return addr;
}


You've misspelt allocArray as alloArray (twice, in fact).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜