#include <stdio.h>

typedef enum SessionState {
        SESSION_OPENING,  /* Session scope is being created */
        SESSION_ONLINE,   /* Logged in */
        SESSION_ACTIVE,   /* Logged in and in the fg */
        SESSION_CLOSING,  /* Logged out, but scope is still there */
} SessionState;

SessionState session_get_state(int s) {
        /* always check closing first */
        if (s == 1)
                return SESSION_CLOSING;
        if (s == 2)
                return SESSION_OPENING;

        return SESSION_ONLINE;
}

void main(){
    SessionState A;
    SessionState B;
    int a = 2;
    int *p = &a;
    A=session_get_state(1);
    B=session_get_state(*p);
    printf("%d\n",A);
    printf("%d\n",B);

}

相关文章:

猜你喜欢
  • 2021-10-12
  • 2022-01-28
  • 2021-08-10
  • 2021-12-05
  • 2021-11-03
相关资源
相似解决方案