#include <iostream>
using namespace std;
struct TK
{
char * des;
int i;
};
#define PROJ_HEAD(id) {#id, 1},
//#id 将id换成字符串
int main()
{
struct TK tks [] ={PROJ_HEAD(eac)
{0,0}};
cout << tks[0].des << endl;
return 0;
}
结果
eac
也可以不使用{},例子代码如下
struct PJ_ELLPS {
char *id; /* ellipse keyword name */
char *major; /* a= value */
char *ell; /* elliptical parameter */
char *name; /* comments */
};
struct PJ_ELLPS
pj_ellps[] = {
"MERIT", "a=6378137.0", "rf=298.257", "MERIT 1983",
"SGS85", "a=6378136.0", "rf=298.257", "Soviet Geodetic System 85",
"GRS80", "a=6378137.0", "rf=298.257222101", "GRS 1980(IUGG, 1980)",
0,0,0,0
};