I have an issue with structures in C, I don't know exactly what is happening. Could you explain me where I am wrong and correct me?
I declared a structure like below
typedef struct  
{
    Fuel_Intrl_IDs Curr_Bar;     /*enum variable*/
    uint16_t Pres_Value; 
    uint16_t Prev_Value;
}Bar_Dync_Data;
I assigned values for all the 3 variables, then when I am accessing data in these variables, value in "Prev_value is always returning "0".
On reassigning the structure as follows, everything is working fine:
typedef struct  
{
    uint16_t Pres_Value; 
    Fuel_Intrl_IDs Curr_Bar;     /*enum variable*/
    uint16_t Prev_Value;
}Bar_Dync_Data;
Can you explain what is happening here?
Code for reproducing
#include <stdio.h>
#include <stdlib.h>
#include <stdint-gcc.h>
typedef enum                                                            /*Fuel Internal IDs*/
{
   Fuel_Intrl_ID_End
}Fuel_Intrl_IDs;
typedef struct                                                          /*Structure for Storing BAR ON/OFF Values*/
{
    Fuel_Intrl_IDs Curr_Bar;
    uint16_t Pres_Value;
    uint16_t Prev_Value;
}Bar_Dync_Data;
 Bar_Dync_Data FBar_Dync_Data;
int main()
{
    printf("Hello world!\n");
    FBar_Dync_Data.Prev_Value = 255;
        while(1)
    {
        printf("\n Enter Pres value ");
        scanf("%d",&FBar_Dync_Data.Pres_Value);
        printf("\n Present value:  %d",FBar_Dync_Data.Pres_Value);
        printf("\n Previous value:  %d",FBar_Dync_Data.Prev_Value);
        FBar_Dync_Data.Prev_Value = FBar_Dync_Data.Pres_Value;
       // getch();
    }
    return 0;
}
 
    