【发布时间】:2019-12-14 08:34:10
【问题描述】:
#include <bits/stdc++.h>
using namespace std;
struct {
struct {
struct {
char *OwO[12];
}iwi;
}uwu;
}owo;
int main() {
*owo.uwu.iwi.OwO = "What's this?";
printf("%s\n", *owo.uwu.iwi.OwO);
return 0;
}
大家好,我不知道这段代码实际上是如何工作的?谁能给我解释一下?
【问题讨论】:
-
那是 C++,但你已经用 C 标记了这个问题。如果你认为代码是 C,那么答案就是 C++。如果您认为它是 C++ 并且想要解释它在 C++ 中的含义,那么您错误地标记了这个问题。无论哪种情况,您不了解哪些具体部分?你了解
#include吗?你了解using吗?你了解struct声明吗?main后面第一行的赋值你看懂了吗?你了解printf声明吗? -
你应该永远
#include <bits/stdc++.h>。它不是正确的 C++。它破坏了便携性并养成了糟糕的习惯。见Why should I not#include <bits/stdc++.h>。 -
另外,请避免
using namespace std;。这被认为是不好的做法,会毁了你的生活。见Why is “using namespace std;” considered bad practice?
标签: c++ arrays struct datamember