Linked List with String

Hello everyone,

I am doing a project for a programming subject. They ask to save a project in a linked list. Here you have my Struct:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  typedef struct dados {

	int ID;

	string title;

	char institution[150];

	char investigator[150];

	string keywords[5];

	float money;

	struct dados *next; //pointer to next nodule

  }No;


This is the 2nd phase of the project, the first one was using a simple array of structs, but this phase they want the same but with a linked list.

I have a function that I use to insert data in a struct. The function ask for an input and I save the data in the struct.

To save a string for title in the first phase I was using this:

getline(cin, no.title);

I want to do the same for the second phase and I did:

getline(cin, no->title);

But it gives this error:

Unhandled exception at 0x00E14E96 in Aplicacao.exe: 0xC0000005: Access violation writing location 0xCDCDCDCD.

I donĀ“t know what to do. Can you help me please?

Thanks a million.
Last edited on

We can't really see what you are doing wrong without posting your code :)
Just got it working. I use No * newNode = new No. Thank you anyway.
Last edited on
Topic archived. No new replies allowed.