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

c++ builder XE4, 10.2 Tokyo > const String [] から配列要素の数を自動取得

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

const Stringで定義した配列の要素数を自動計算したい。

	const String kPanelNames[] = {
		L"P_1_1",
		L"P_1_2",
		L"P_1_3",
	};
	int numPanels = sizeof(kPanelNames) / sizeof(String *);

似たようなことをTPanel[]でもやっていた。
http://qiita.com/7of9/items/22165ecf3e7636bc53fe

分母をポインタとしてsizeof()を取れば他のものに対しても同様に使える。

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?