error: invalid application of ‘sizeof’ to incomplete type ‘struct ’
list.c:47:39: error: invalid application of ‘sizeof’ to incomplete type ‘struct Litsnode’
So, I was trying to run a program based on linked list and this is what I got.
This is a very silly problem. I am mentioning it here just to help those who got frustrated like me :-\
Let me show you the line where this error occurred :
46 struct Listnode * newnode;
47 newnode = (struct Listnode *) malloc(sizeof(struct Litsnode));
Now, View it properly. Check the name(spelling) of the structure mentioned to sizeof : "struct Litsnode". Though the defined name of the structure was : "struct Listnode"
That's it.
This happens all the time that we may type something wrong. The important thing is to identify it. :-)
Feel free to give any suggestions :)
So, I was trying to run a program based on linked list and this is what I got.
This is a very silly problem. I am mentioning it here just to help those who got frustrated like me :-\
Let me show you the line where this error occurred :
46 struct Listnode * newnode;
47 newnode = (struct Listnode *) malloc(sizeof(struct Litsnode));
Now, View it properly. Check the name(spelling) of the structure mentioned to sizeof : "struct Litsnode". Though the defined name of the structure was : "struct Listnode"
That's it.
This happens all the time that we may type something wrong. The important thing is to identify it. :-)
Feel free to give any suggestions :)
Was sitting all evening trying to understand what is wrong with my program and all it was I mistyped "Connection"- forgot second n.
ReplyDeleteThan you for paying my attention Gene or else I think I would never ever found it. ;)
-Ed
You are welcome :)
DeleteHappy Coding!!
i have also done the same mistake and it makes me laugh that i was getting frustrated over a silly mistake thank you for sharing the useful info.
ReplyDelete