training

Code I wrote during training
git clone git://git.bitsmanent.org/training
Log | Files | Refs | README

10.3 (406B)


      1 /* Exercise 10.3 */
      2 
      3 a)
      4    struct part {
      5       int partNumber;
      6       char partName[25];
      7    };
      8 
      9 b)
     10    typedef struct part Part;
     11 
     12 c)
     13    Part a, b[10], *ptr;
     14 
     15 d)
     16    printf("Number of part: ");
     17    scanf("%d", &a.partNumber);
     18 
     19    printf("Name of part: ");
     20    scanf("%s", &a.partName);
     21 
     22 e)
     23    b[3] = a;
     24 
     25 f)
     26    ptr = b;
     27 
     28 g)
     29    printf("P.No: %d\n", ptr[3]->partNumber);
     30    printf("P.Na: %s\n", ptr[3]->partName);
     31