Results 1 to 4 of 4
  1. #1

    Default C self ref struct


    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)

  2. #2

    Default Re: C self ref struct

    unsa-on ni pag close sa thread?? wala ra diay & akong scanf amff bogoa nako oi..!

  3. #3

    Default Re: C self ref struct

    scanf("%d",&(n->data));

  4. #4

    Default Re: C self ref struct

    hehe ana jd na bro... lisod debug basta C.. whereas jave makes your life easy...

  5.    Advertisement

Similar Threads

 
  1. How to hav self confidence
    By kyme in forum General Discussions
    Replies: 29
    Last Post: 03-22-2008, 11:35 PM
  2. Replies: 4
    Last Post: 07-22-2006, 11:44 AM
  3. amd proc. quick ref. guide...
    By StyM in forum Computer Hardware
    Replies: 12
    Last Post: 12-24-2005, 01:08 PM
  4. SMS will Self-Destruct in 40 Seconds
    By samsungster in forum Gizmos & Gadgets (Old)
    Replies: 4
    Last Post: 12-16-2005, 09:10 PM
  5. "Self-Healing" Scratch resistant paint
    By [DSX] in forum Gizmos & Gadgets (Old)
    Replies: 6
    Last Post: 12-08-2005, 02:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top