hello sirs, why is this code not working? it does nothing special just trying to understand.
Code:
#include <stdio.h>
#include <stdlib.h>
struct node
{
int a;
struct node *next;
};
struct node *a;
a = (struct node *)malloc(sizeof(struct node));
int main(){
//d nothing
}
the error on the compiler logs(code blocks)
are
Code:
||=== Build file: "no target" in "no project" (compiler: unknown) ===|
C:\Users\xx\Documents\strcts\struct_stack.c|12|warning: data definition has no type or storage class|
C:\Users\xx\Documents\strcts\struct_stack.c|12|error: conflicting types for 'a'|
C:\Users\xx\Documents\strcts\struct_stack.c|11|note: previous declaration of 'a' was here|
C:\Users\xx\Documents\strcts\struct_stack.c|12|warning: initialization makes integer from pointer without a cast|
C:\Users\xx\Documents\strcts\struct_stack.c|12|error: initializer element is not constant|
||=== Build failed: 2 error(s), 2 warning(s) (0 minute(s), 0 second(s)) ===|