using struct keyword in variable declaration in C++

前端 未结 6 1935
暗喜
暗喜 2020-11-27 07:34

I have a feeling this may be related to C syntax, but I started my programming life with C++ so I am not sure.

Basically I have seen this:

struct tm          


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-27 07:56

    In your example tm can have been a typecasted structure.

    e.g.

    typedef struct tm_t
    {
      int x; 
    }tm;
    

    and then you can do

    tm t; 
    

提交回复
热议问题