#include <stdio.h>
#include <stdlib.h>
typedef struct{
char *name;
char *city;
int age;
}data;
int addName(data *d){
d->name = "lady gaga";
return 0;
}
int addCity(data *d){
d->city = "new york";
return 0;
}
int addAge(data *d){
d->age = 24;
return 0;
}
char* getName(data *d){
return d->name;
}
char* getCity(data* d){
return d->city;
}
int getAge(data* d){
return d->age;
}
int main(int c){
system("color 5f");
data* list;
list = (data*) malloc(1*sizeof(data));
addName(list);
addCity(list);
addAge(list);
printf("%s, %d of %s",getName(list), getAge(list), getCity(list));
return 0;
}
#include <stdlib.h>
typedef struct{
char *name;
char *city;
int age;
}data;
int addName(data *d){
d->name = "lady gaga";
return 0;
}
int addCity(data *d){
d->city = "new york";
return 0;
}
int addAge(data *d){
d->age = 24;
return 0;
}
char* getName(data *d){
return d->name;
}
char* getCity(data* d){
return d->city;
}
int getAge(data* d){
return d->age;
}
int main(int c){
system("color 5f");
data* list;
list = (data*) malloc(1*sizeof(data));
addName(list);
addCity(list);
addAge(list);
printf("%s, %d of %s",getName(list), getAge(list), getCity(list));
return 0;
}
No comments:
Post a Comment