Advertisement
kk258966

資料結構4/9

Apr 8th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. typedef struct student{
  5.     char id[10];
  6.     char name[20];
  7.     int age;
  8.     int height;
  9.     int weight;
  10. }Student;
  11.  
  12. int main(void){
  13.    
  14.     Student* ptr;
  15.     ptr=(Student*)malloc(sizeof(Student));
  16.     ptr->age=18;
  17.     ptr->height=180;
  18.    
  19.     struct student s1;
  20.     Student s2;
  21.     s1.id[0]='B';
  22.     s1.age=18;
  23.     printf("%c %d",s1.id[0],s1.age);
  24.    
  25.    
  26.     system("pause");
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement