1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

M5NanoC6で構造体の長さを計って遊ぶ[sizeof(型)]

Last updated at Posted at 2025-01-30

x 過去ログを見ょ!!!
x 「シリアルモニタ」は、なんどか開き直す
x 3.1.1

目的
構造体のレングスを計る
使用する(関数では、なく)[演算子]は、sizeof(型)です。

いろいろ
ちなみに、ここは、東京近郊である。
昨日(20250129)、東京芸大に見学(卒業作品)に行ったら
インタラクティブ系にSG-90ぽいのが使われていた様な?
日本画家系は、あまり影響を受けていないが
それ以外は、アニメの影響を受けていた。
(この世界では、浮世絵が再評価されているぽい?)
未来の端末系(ガラ携系(いつの話))が観測範囲では、まったくなかった。
え~~~~~~~~~

結果

o_coq786.jpg

プログラム






//ser_struct_length_M5NanoC6

void setup() {
  // put your setup code here, to run once:

  //シリアルの初期化
  Serial.begin(9600);
  Serial.println("");
  //シリアルの待ちが0.5*9
  for (int i = 0; i < 9; i++) {
    delay(500);  //接続待ち
    Serial.print(".");
  }  //for
  Serial.println("");

  Serial.printf("int -> (%d)\n",sizeof(int));
  Serial.println("");

  struct {
    int sw1;
    int sw2;
  } SWs;

  Serial.printf("SWs -> (%d)\n",sizeof(SWs));
  Serial.println("");
}

void loop() {
  // put your main code here, to run repeatedly:

}





1
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?