- Beranda
- Komunitas
- Tech
- Programmer Forum
Linked List


TS
novacammy
Linked List
Code:
#include<iostream>
#include<ctime>
#include<stdlib.h>
using namespace std;
struct node
{
int data;
struct node *link;
};
int main()
{
srand(time(NULL));
struct node *n;
struct node *p = NULL;
struct node *status = NULL;
n = (struct node*)malloc(sizeof(struct node));
for(int i=0; i<5; i++){
n->data = rand()0+1;
n->link = p;
p = n;
for(int i=0; i<4;i++){
struct node *hapus;
hapus = temp->next;
data = data->next;
temp->link = NULL;
free(temp);
}
cout<< p -> data << " ";
}
return 0;
}
Nah kan disini udah dibnetuk linked list terus rencananya mau dihapus, nah tersu hapusnya gimana ya? soalnya lagi coba tapi nggak ketemu fungsinya.
0
660
2


Komentar yang asik ya
Urutan
Terbaru
Terlama


Komentar yang asik ya
Komunitas Pilihan