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).
精彩评论