简化代码,求方法!
typedef struct
{
//存Span里面的有颜色 无颜色 粗体等内容
char* pcSpanColor[100];
char* pcSpanNotColor[20];
char* pcSpanCenter[20];
char* pcSpanIndent[30];
char* pcSpanBold[100];
//存Para里面的有颜色 无颜色 粗体等内容
char* pcPColor[100];
char* pcPNotColor[20];
char* pcPCenter[20];
char* pcPIndent[30];
char* pcPBold[100];
}SHtmlHead;
SHtmlHead SHtmlHeadInfo;
存Span内容的指针数组变量
int ihecl = 0;
int inotcl = 0;
int icenter = 0;
int iinde = 0;
int iBold =0;
存Para内容的指针数组变量
int iPhecl = 0;
int iPnotcl = 0;
int iPcenter = 0;
int iPinde = 0;
int iPBold =0;
这样定义和操作 感觉很繁琐,有没有好的方法,如何简化?
[解决办法]
类似这样:
typedef struct{ char* Color[100]; char* NotColor[20]; char* Center[20]; char* Indent[30]; char* Bold[100];}style_t;typedef struct{ style_t span; style_t pc;}SHtmlHead;