typedef struct node node;
// LinkedList data structure to hold characters.
struct node {
char character;
node *link;
};
Later I try:
node *tmp = malloc(sizeof (node));
And I get an error in my text editor saying:
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
error: cannot initialize a variable of type 'node *' with an rvalue of type 'void *'
node *tmp = malloc(sizeof (node));
^ ~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[Finished in 0.1s with exit code 1]
I get the same error in Xcode, but it works and compiles fine using gcc in Terminal. How come?
Thanks in advance.