i'm working/trying to learn about "struct list".
First I tried to do without typedef without success getting the following compilation error the code is for it is just under.
my question is why the the first one do not work? and what do I have to change to make it work without making typedef. the working code I will include as well.
$ g++-4.7 -Wall -Wextra -pedantic -std=c++11 test1.cc
test1.cc:9:22: error: field ‘next’ has incomplete type
test1.cc: In function ‘int main()’:
test1.cc:16:18: error: conversion from ‘int’ to non-scalar type ‘Lista’ requested
test1.cc: In function ‘void insert(Lista&, int)’:
test1.cc:29:14: error: variable ‘insert(Lista&, int)::list newlist’ has initializer but incomplete type
Wow, you just messed it all up... version with typedef have a pointer to Lista, and other example is an instance.., then you try this struct list newlist=new Lista;new return pointer for newly crated Lista and you are trying assign it to instance.