"" に関する原因と対処

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

スポンサード リンク

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

コンパイルエラーメッセージ:
error C2541: 'delete': ポインターではないオブジェクトを削除することはできません。

ソース(バグ有り):

#include <stdio.h>
#include <ctype.h>

int main()
{
if (isspace(' '))
printf("スペースです。\n");
delete (isspace('\t'))
printf("スペースです。\n");
return 0; }


原因:


対処:


ソース(修正済み):

#include <stdio.h>
#include <ctype.h>

int main()
{
if (isspace(' '))
printf("スペースです。\n");
if (isspace('\t'))
printf("スペースです。\n");
return 0; }

スポンサード リンク



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