0
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?

More than 1 year has passed since last update.

【組込み開発】よく使う関数とデータ型について

Last updated at Posted at 2023-11-02

はじめに

今回の記事では、これまでに約1年と半年、組み込みソフト開発に携わってきた中で、よく見かける関数やデータ型についての紹介をしていきます。

①memset:配列を0x00で初期化したい時などに使用

memset関数の書式は以下です:

memset(void *buf, int ch, size_t n)

1引数:メモリのポインタ
2引数:セットする値
3引数:セットするサイズ

②memcpy:データをコピーしたい時などに使用

memcpy関数の書式は以下です:

memcpy(void *buf, const void *buf2, size_t n)

1引数:コピー先のメモリのポインタ
2引数:コピー元のメモリのポインタ
3引数:コピーサイズ

③列挙型:状態を定義するときなどに使用

列挙型の定義方法は以下です:

typedef enum{

    // 以下にメンバ変数を定義します
    eExample1 = 0,
    eExample2,
    eExample3,
}eExample;

定義方法は構造体と同じ(structがenumに変わっただけ)ですね。

おわりに

今回は組み込みソフト開発でよく出てくる関数やデータ型について紹介しました。
少しでも皆様のお役に立てれば幸いです。
最後までご覧いただきありがとうございました。

0
0
0

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
0
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?