728x90

분류 전체보기 200

아랫거랑 유사...- _-;삽질한거같아 다시 짜봄;;

#include #include #include typedef struct{ int sn; char *name; }student; student *std; int n=0; void inputd(student *std) { if(nsn); (std+n)->name=(char*)malloc(sizeof(char)); printf("Input Name:"); scanf("%s",(std+n)->name); n++; } else { printf("memory full\n"); } } void outd(student *std) { int a; for(a=0;asn,(std+a)->name); } } void main() { int a; std=(student *)malloc(sizeof(student)*3); w..

단순....입력받아 출력...구조체 연습중..

#include #include #include typedef struct{ char *name; char *sn; int escore; int mscore; }student; student *record; int n=0; void inputdata(student *ptr) { if(n >= 3) { printf("Memory Full~\n"); } else { (ptr+n)->name=(char *)malloc(sizeof(char)); (ptr+n)->sn=(char *)malloc(sizeof(char)); printf("Input data\n"); printf("Name : "); scanf("%s",(ptr+n)->name); printf("School Number : "); scanf("%s"..

728x90