I have created a linkedlist with data as string datatype . The build is sucess but while execution of the program a window with the following message " linkedlistexaample.exe has stopped working " message is displaying.
my declaration is as follows
#include <iostream.h>
#include <string.h>
using namespace std;
struct list
{
string data;
list* next;
}
int main()
{ list *list1 ;
cin>>list1.data;
cout<<list1.data;
return 0;
}
how does strings are stored in the memory ,how their operations will be done in linkedlist .
Lists and nodes are pretty much the same in this context. There is little difference in having a list of objects and simply a pointer to the first element, which carries a pointer to the next. A node is just a more general term as it can be used in many ways (e.g. trees, single/double linked lists, etc).