Şimdi Ara

program geliştirme yardımmm2

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir (1 Mobil) - 1 Masaüstü1 Mobil
5 sn
3
Cevap
0
Favori
429
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Herkese merhaba, ben 3 linked list olusturdum headleri ayrı ayrı tuttum ve baska bir fonsiyona gecirdim ancak degere ulasmak ıstedıgımde adrese ulasıp degeri vermiyor lutfen yardım..
    // int sum() kısmında adrese ulasamıyorum



    #include<stdlib.h> 
    #include<stdio.h>

    typedef struct linkedlist_node {
    int data;
    struct linkedlist_node *next;
    }NODE;




    int linklist(NODE *,int);
    int sum(NODE *,NODE *,NODE *);


    int main() {
    NODE *head1=NULL,*head2=NULL,*head3=NULL,*head4=NULL;
    int y;

    printf("--PLEASE ENTER ELEMENTS OF MATRIX[3][3]--\n");
    linklist(head1,1);
    linklist(head2,2);
    linklist(head3,3);

    sum(head1,head2,head3);

    return 0;
    }

    int linklist(NODE *head,int s){

    NODE *tail;
    int value,x;

    for(x=1;x<=3;x++){
    printf("\nplease enter element of matrix[%d][%d]:",s,x);
    scanf("%d",&value);


    if(head==NULL){ /// ilk düğüm oluşturulmadıysa önce onu oluşturuyoruz.
    head = (NODE *)malloc(sizeof(NODE));
    if(head==NULL) return 0;//hafıza doluysa programı sonlandır

    head->data = value;
    head->next = NULL;
    tail = head; /// Sadece ilk düğüm için, head = tail
    } else {
    NODE *temp = (NODE *)malloc(sizeof(NODE)); /// Eklenecek düğümler için memory allocation
    if(temp==NULL) return 0;//hafıza doluysa programı sonlandır

    temp->data = value;
    temp->next = NULL;
    tail->next = temp;
    tail = tail->next;
    }

    }

    return 0;
    }

    int sum(NODE *head1,NODE *head2,NODE *head3){
    int eleman1,eleman2,eleman3,x=12;


    NODE *curr;


    curr=head1;
    printf("\n DATA :%d",curr->data);

    curr=head2;
    printf("\n DATA :%d",curr->data);

    curr=head3;
    printf("\n DATA :%d",curr->data);





    }









  •  
    #include<stdlib.h>
    #include<stdio.h>

    typedef struct linkedlist_node {
    int data;
    struct linkedlist_node *next;
    }NODE;




    int linklist(NODE **,int);
    int sum(NODE *,NODE *,NODE *);


    int main() {
    NODE *head1=NULL,*head2=NULL,*head3=NULL,*head4=NULL;
    int y;

    printf("--PLEASE ENTER ELEMENTS OF MATRIX[3][3]--\n");
    linklist(&head1,1);
    linklist(&head2,2);
    linklist(&head3,3);

    sum(head1,head2,head3);

    return 0;
    }

    int linklist(NODE **head,int s){

    NODE *tail;
    int value,x;

    for(x=1;x<=3;x++){
    printf("\nplease enter element of matrix[%d][%d]:",s,x);
    scanf("%d",&value);


    if(*head==NULL){ /// ilk düğüm oluşturulmadıysa önce onu oluşturuyoruz.
    *head = (NODE *)malloc(sizeof(NODE));
    if(*head==NULL) return 0;//hafıza doluysa programı sonlandır

    (*head)->data = value;
    (*head)->next = NULL;
    tail = *head; /// Sadece ilk düğüm için, head = tail
    } else {
    NODE *temp = (NODE *)malloc(sizeof(NODE)); /// Eklenecek düğümler için memory allocation
    if(temp==NULL) return 0;//hafıza doluysa programı sonlandır

    temp->data = value;
    temp->next = NULL;
    tail->next = temp;
    tail = tail->next;
    }

    }

    return 0;
    }

    int sum(NODE *head1,NODE *head2,NODE *head3){
    int eleman1=0,eleman2=0,eleman3=0,toplam;


    NODE *curr;


    curr=head1;
    for(;curr!=NULL;)
    {
    printf("\n DATA :%d",curr->data);
    eleman1+=curr->data;
    curr=curr->next;
    }

    curr=head2;
    for(;curr!=NULL;)
    {
    printf("\n DATA :%d",curr->data);
    eleman2+=curr->data;
    curr=curr->next;
    }

    curr=head3;
    for(;curr!=NULL;)
    {
    printf("\n DATA :%d",curr->data);
    eleman3+=curr->data;
    curr=curr->next;
    }
    toplam=eleman1+eleman2+eleman3;
    printf("\n\ntoplam=%d",toplam);

    return toplam;




    }




  • cok ugrasmıstım duzeltmek ıcın, tesekkurler :)
  • Yapay Zeka’dan İlgili Konular
    TXT Tool Yardım Python
    geçen ay açıldı
    Daha Fazla Göster
    
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.