0
1

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 5 years have passed since last update.

c++ builder XE4, 10.2 Tokyo > TPanel * の配列から配列要素の個数を取得 > int numPanels = sizeof(dstPanels) / sizeof(TPanel *);

Last updated at Posted at 2015-10-11
動作確認
C++ Builder XE4
Rad Studio 10.2 Tokyo Update 2 (追記: 2017/12/27)

TPanel *[]の配列を定義して、自動的にその個数を取得したい。

以下でできた。

	TPanel *dstPanels[] = {
			/*P01TL,*/ P01BL, P01TR, P01BR,
			P02TL, P02BL, P02TR, P02BR,
			P03TL, P03BL, P03TR, P03BR,
			P04TL, P04BL, P04TR, P04BR,
			P05TL, P05BL, P05TR, P05BR,
		};
	int numPanels = sizeof(dstPanels) / sizeof(TPanel *);

分母のsizeof()をTPanel型でなくTPanel *型ですればよかったのに気づいた。

ちなみにTPanel *のsizeof()はこちらのビルド設定では4だった。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?