Am I missing anything here in my statement about c++?

前端 未结 5 440
慢半拍i
慢半拍i 2021-01-20 12:03

You can\'t have code outside of functions except for declarations, definitions and preprocessor directives.

Is that statement accurate, or is there something I\'m mi

5条回答
  •  囚心锁ツ
    2021-01-20 12:48

    • For your nephew:
      no, you can't do it.
    • For yourself:
      The compiler's input is technically what you get after the preprocessor is run. So, let's leave preprocessor out. After it has worked, you get a C++ program which is a sequence of declarations. Some delcarations may also be definitions, and some definitions (like function definitions) may have statements inside them.
      HTH

提交回复
热议问题