After i enter value of num in function getInfo , value of d->id changes to 0.
If i change data type of num and id from short int to int . Problem doesn't occur.
Or
If i change order of reading data as
1 2 3 4
printf( "\nEnter num >" );
scanf( "%d",&(d->num) );
printf( "\nEnter id > " );
scanf( "%d",&(d->id) );
because scanf("%d") scans for an integer (4 bytes).
A short is only 2 bytes long - hence (becaus of the order you are getting the values) you are overwriting id with the top two bytes of the num value, that's why the num changes after you have got it.
(p.s it would overwite it anyway if you see what I mean).
Also getting 4 bytes to the id variable means that you are corrupting the stack, because the top 2 bytes of id will be written outside the structure.
Noe: stack and structure corrption is also possible getting the name value, because name is only 30 chars long. The user can enter 100 characters which is way bigger than the size of the structure also overwriting the id and name.