Monday, 26 August 2013

Error while generating an array of pointer

Error while generating an array of pointer

Trying to implement below code for some assignment but getting an error
for malloc array generation "[Error] conflicting types for 'stack'" Any
Help ?? Thanks in Advance.
#include<stdio.h>
#include<stdlib.h>
struct treenode
{
char info;
struct treenode *firstchild;
struct treenode *next;
int flag;
};
typedef struct treenode *NODEPTR;
NODEPTR *stack;
// Trying to create array here
stack=(NODEPTR*)malloc(sizeof(NODEPTR)*20);
int main()
{
printf("YO\n");
return 0;
}

No comments:

Post a Comment