using struct keyword in variable declaration in C++

前端 未结 6 1931
暗喜
暗喜 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:46

    Using struct tm t; is for compatibility with C, in which declaring a struct named "tm" defines a type named "struct tm" but not one named "tm" (as opposed to C++, in which both names for the type are declared).

提交回复
热议问题