开发者

expected unqualified id before '\0'

开发者 https://www.devze.com 2023-03-16 03:39 出处:网络
I tried following things b开发者_Go百科ut I am getting the error typedef \'\\0\' DEFAULT_VALUE; Error: expected unqalified id before \'\\0\'`

I tried following things b开发者_Go百科ut I am getting the error

typedef '\0' DEFAULT_VALUE;   

Error: expected unqalified id before '\0'`

typedef NULL DEFAULT_VALUE;   

Error: expected unqalified id before __null

what I am doing wrong here?


The general syntax of a typedef is:

typedef existing_type new_type_name ;

Since '\0' and NULL are not existing types you get the error.

Since you want define constants you can use the const as:

const int DEFAULT_VALUE = '\0';


The keyword typedef defines synonym for existing type. Neither \0 nor NULL are type. May be you want something as follows:

#define DEFAULT_VALUE NULL
0

精彩评论

暂无评论...
验证码 换一张
取 消