Кажется, что каждый гид - как создать LLL с помощью ints, но у меня возникли проблемы с использованием указателей на символы. когда я запускаю этот код, он возвращает ошибку сегментации сразуКак создать LLL массивов char
вот мой код до сих пор
struct node
{
char * data;
node * next;
};
void build(node * head);//create list
void manipulate(node * & head);//manipulate list
void display(node * head);//display all
void delete_list(node * head);//delete all nodes in linked list
bool again();//asks user if they'd like to continue
int main()
{
node * head = NULL;
//create list from user1 input
while(again)
build(head);
//displays list
display(head);
//manipulate list as user2 reads through it
manipulate(head);
return 0;
}
void build(node * head)
{
head->next = new node;
char * data = new char;
cout << "where to visit? ";
cin.get(head->data,strlen(data)+1,'\n');
head = head->next;
}
и что говорит отладчик – pm100
WTH's ** LLL ** ?? Объясните пожалуйста ... –
Вы просто '' '' '' '' '' 'в своем' while' вместо того, чтобы вызывать его. Он всегда будет оценивать значение 'true'. –