Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
506 B
12
Indexable
Never

#include <stdio.h>
 typedef struct Deneme {
    int value;
    void(*set)(struct Deneme* ,int );
    int (*get)(struct Deneme* );
}Deneme;


void setter(Deneme *d,int deger){
    d->value=deger;
}
int getter(Deneme *d){
    return d->value;
}

int main()
{   
    Deneme deneme1;
    deneme1.set=setter;
    deneme1.get=getter;
    deneme1.value=25;
    //deneme1.set=(&deneme1,24);set fonksiyonu calismiyor amkkkkkkkkkkkneyi yanlis acaba 
    
    printf("%d",deneme1.get(&deneme1));
    
    return 0;
}