struct car *addtolist(struct car *first);
{
As long as you write these 2 lines inside main()
, you declared the function prototype of addtolist()
, and started a scope. You are not defining the function addtolist()
. Thus, the later return newcar;
returns a variable with incorrect type since main()
returns int
.