Mga migo nag problema ko sa self ref struct
nakasabot naman tako nawala na sad sa akong utok amf.see my code this is just a sample
HTML Code:
#include<stdio.h>
struct boang
{
struct boang *next;
int data;
};
typedef struct boang amaw;
void main()
{
int x;
amaw *n,*we;
n=malloc(1*sizeof(amaw));
n->data=1;
we=n;
for(x=1;;)
{
n->next=malloc(1*sizeof(amaw));
n=n->next;
printf("Enter a num 0 if you want to end: ");
scanf("%d",n->data);
if(n->data==0)
{
break;
n->data=NULL;
}//end if
}//end for
}
the goal for this program is para ma end nako ang self ref struct pero dili sya mo end dyud i think my problem is the n->data==0 dyud nga
(paita ning makalitan rata oi XD)