habe hier einen Codeausschnitt. Wie kann ich ohne "->" auf das zugreifen, worauf np1´s next Zeiger hinzeigt und davon die int Komponente.
#include <stdio.h>
typedef struct node {
int data;
struct node* next;
} Node, *nodeptr;
int main () {
nodeptr np1=(nodeptr)malloc(sizeof(Node));
nodeptr np2=(nodeptr)malloc(sizeof(Node));
np1->data=1;
np1->next=np2;
np2->data=2;
np2->next=NULL;
printf("%d\n",(*np1).(*next).data);
system("pause");
return 0;
}
Also
printf("%d\n",(*np1).next->data);
printf("%d\n",np1->next->data);
klappt natürlich.
Danke
