Advertisement
tonylight2016

c内存数据

Nov 25th, 2020
735
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. typedef struct helper{
  4.         int nNo;
  5.         int nAge;
  6.         char sName[10];
  7. }struhelper;
  8.  
  9. int main()
  10. {
  11.         int i = 0;
  12.         struhelper helpers[] ={
  13.         [0] = {0, 15, "tom"},
  14.         [1] = {1, 25, "hellon"},
  15.         [2] = {2, 23, "jim"},
  16.         [3] = {3, 21, "lilei"}
  17.         };      
  18.         for(i=0;i<4;i++)
  19.             printf("No=%d, Age=%d, Name=%s\n", helpers[i].nNo, helpers[i].nAge, helpers[i].sName);
  20.         return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement