banner
cells

cells

为美好的世界献上 code

Q193

Q193#

#include <iostream>

int main() {
    int a[] = <%1%>;
    std::cout << a<:0:>;
}

Answer#

click to see answer 1

Explain#

C++ provides alternative tokens for some punctuators. The two weird lines are exactly equivalent to

int a[] = {1};
std::cout << a[0];

"Alternative token representations are provided for some operators and punctuators."

"In all respects of the language, each alternative token behaves the same, respectively, as its primary token, except for its spelling."

Then, a table of alternative tokens is provided, which includes

  • <% and %> for { and }
  • <: and :> for [ and ]
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.