aboutsummaryrefslogtreecommitdiffstats
path: root/7_2/include/common.h
diff options
context:
space:
mode:
authorjustanothercatgirl <sotov2070@gmail.com>2024-10-17 17:38:07 +0300
committerjustanothercatgirl <sotov2070@gmail.com>2024-10-17 17:38:07 +0300
commit82ec99f51b2b3b7a7b36b43b22df07ec503158b8 (patch)
tree4b308e68145ff124c50c7a5d4ebec8f0060d35e6 /7_2/include/common.h
parent5d294755542190ac5135af8e120e313b55828625 (diff)
task7 initial commit
Diffstat (limited to '7_2/include/common.h')
-rw-r--r--7_2/include/common.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/7_2/include/common.h b/7_2/include/common.h
new file mode 100644
index 0000000..660532f
--- /dev/null
+++ b/7_2/include/common.h
@@ -0,0 +1,32 @@
+#ifndef JAC_COMMON_H
+#define JAC_COMMON_H
+
+/* Для чтающих:
+ * чтобы писать
+ * `vector2 point = { 10, 20 };`
+ * вместо
+ * `struct vector2 point = { 10, 20 };`
+ * (то есть чтобы писать struct перед vector2 было необязательно)
+ * надо объявлять структуру так:
+ * ```
+ * typedef struct {
+ * long x, y;
+ * } vector2;
+ * ```
+ * Таким образом мы объявляем структуру без официального названия,
+ * но присваиваем ей синоним. Чтобы пользоваться и тем, и тем вариантами,
+ * можно сделать так:
+ * ```
+ * typedef struct vector2 {
+ * long x, y;
+ * } vector2;
+ * ```
+ * Так мы и даём ей название, и даём ей синоним.
+ */
+
+// координаты точки в 2-мерном пространстве
+typedef struct vector2 {
+ long x, y;
+} vector2;
+
+#endif // JAC_COMMON_H