"" に関する原因と対処

このコンパイルエラーの原因と対処に関して説明します。

スポンサード リンク

Microsoft Visual C++にて以下のソースでコンパイルエラーが発生します:

コンパイルエラーメッセージ:
warning C4305: '初期化中': 'unsigned int' から 'bool' へ切り詰めます。

ソース(バグ有り):

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
char string[] = "これはテスト文字列です。";
bool n=_countof(string);
printf( "%d\n", n ); }


原因:


対処:


ソース(修正済み):

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
char string[] = "これはテスト文字列です。";
int n=_countof(string);
printf( "%d\n", n ); }

スポンサード リンク



[コンパイルエラーコード、メッセージに戻る]