suppose I have a struct named nodeType with(info of type Type, and a pointer named link of type nodeType)
also I have a class named linkedListType with private members (*first of type nodeType, *last of type nodeType, count of type integer)
This code to insert a new node at certain position
Have you tested it? Writing test units is a very important skill to have. I recommend doing this, and if something is broken then come back and tell us what doesn't work and we'll be glad to help you from there.
Ruthless wrote:
Also, do I need to delete (cur & tail) when their work is over?
You only delete objects that were created with new. Since cur and tail are just pointers you created on the stack, they will be gone by the time this function exits.
For some reason I am unable to run my program.. I always get these 2 errors
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>c:\users\ruthless\documents\visual studio 2012\Projects\LinkedList\Debug\LinkedList.exe : fatal error LNK1120: 1 unresolved externals
I googled about this and tried multiple things, still same problem.
Yes I am sure that I started a new project in the right way, but I have no clue what is this error about.
That is why I asked if this function is right or no, I need to know how to write it in the correct way for tomorrow and I am unable to test it.
Well, I just noticed that I have an extra template for a function I didn't write so the compiler thought its with the main function.
I removed it now and my program worked.
Everything works fine, but when I choose a position equals to the length, nothing changes.