首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

简化代码,求方法!解决方案

2012-09-13 
简化代码,求方法!typedef struct{//存Span里面的有颜色 无颜色 粗体等内容char* pcSpanColor[100]char* p

简化代码,求方法!
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;

这样定义和操作 感觉很繁琐,有没有好的方法,如何简化?

[解决办法]
类似这样:

C/C++ code
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; 

热点排行