As I told you yesterday:
Error C++ struct with pointer[
^] THOSE AREN'T POINTERS.
struct test
{
int next;
int previous;
int value = 0;
};
next
and
previous
cannot be declared as
int
- they need top be pointer values and preferably pointers to the actual destination type:
struct test
{
struct test *next;
struct test *previous;
int value = 0;
};
If you don't, then you will get problems. Integers are 32 bit values (in a modern compiler), but on a 64 bit system pointers are 64 bit values: so when you set a pointer to an address you need a destination that has enough space to store an entire 64 bit value, if you don;t have that, then something is going to get overwritten...
To add to that, your "next" code is total garbage!
test *coba, testt;
coba = &testt;
...
(++coba);
testt.next = (*coba).value;
No, you cant just do that - you are using memory you haven't allocated whine you use ++, so you will again start corrupting memory. NAd that last line? What the heck do you expect that to do?
Stop guessing. Read your course notes, and start thinking. Hope and pray is not a viable design strategy...