0
#include<conio.h>
#include<stdio.h>
#include<alloc.h>
typedef struct node
{
int data;
struct node *n_next,*next,*p_pre,*pre;
};
int main()
{
node *head,*p,*q,*r,*s;
head=(struct node*) malloc(sizeof(struct node));
p=head;
q=(struct node*) malloc(sizeof(struct node));
r=(struct node*) malloc(sizeof(struct node));
s=(struct node*) malloc(sizeof(struct node));
printf(" \nEnter the data of the node ");
scanf("%d",&p->data);
printf("\nEnter the data for second node ");
scanf("%d "&q->data);
printf("\nEnter the data for third node ");
scanf("%d "&r->data);
printf("\nEnter the data for fourth node ");
scanf("%d ",&s->data);
getch();
return(0);
}
После компиляции кода, как ожидается, принимать 4 значения и хранить их в поле данных уважаемых узлов, но он говорит ..Почему это не работает? [Linklist]
scanf ("% d", & p-> данные); // Незаконное использование указателя ???? Как это так?
Какая часть кода повреждена и ее необходимо устранить?
Вы не дали имя ЬурейеЕ для 'структуры node'. –
, и что именно следует указывать? – Ivean
См. Ответ teppic. –