#include
#include
#define MAX 10
void out_string(char *[],int);
void out_ASCII(char *[],int);
void out_order(char *[],int);
void out_as_first_string(char *[],int);
int main(void)
{ int ct=0;
char * ptr[MAX];
printf("enter the string ,at most 10 line,double enter to quit\n");
while(ct<MAX&&gets(ptr[ct])!=NULL&&ptr[ct][0]!='\0')
ct++;
out_string(ptr,ct);
out_ASCII(ptr,ct);
out_order(ptr,ct);
out_as_first_string(ptr,ct);
return 0;
}
void out_string(char *pt[],int line)
{ int rows;
for( rows=0;rows<line;rows++)
puts(pt[rows]);
}
void out_ASCII(char pt[],int line)
{ int rows;
int clos;
for( rows=0;rows<line;rows++)
{ clos=0;
while(((*pt+rows)+clos))
{
printf("%5d",*((pt+rows)+clos));
clos++;
}
}
}
void out_order(char *pt[],int line)
{ int rows;
int clos;
int num;
char *temp;
temp=pt[0];
for( rows=0;rows for( clos=rows;clos {
if(strlen(pt[rows])>strlen(pt[clos]))
temp=pt[rows];
pt[rows]=pt[clos];
pt[clos]=temp;
}
for( num=0;num<line;num++)
puts(pt[num]);
}
void out_as_first_string(char *pt[],int line)
{ int rows;
int len=strlen(pt[0]);
for( rows=0;rows<line;rows++)
pt[rows][len+1]='\0';
for( rows=0;rows<line;rows++)
puts(pt[rows]);
}
应用程序名: 未命名13.exe
应用程序版本: 0.0.0.0
应用程序时间戳: 580578a0
故障模块名称: msvcrt.dll
故障模块版本: 7.0.7601.17744
故障模块时间戳: 4eeaf722
异常代码: c0000005
异常偏移: 00078c57
OS 版本: 6.1.7601.2.1.0.256.48
区域设置 ID: 2052
其他信息 1: 0a9e
其他信息 2: 0a9e372d3b4ad19135b953a78882e789
其他信息 3: 0a9e
其他信息 4: 0a9e372d3b4ad19135b953a78882e789
如果是在VS环境下编程,在运行崩溃后程序没有停止运行,而是跳到某行代码的话,你看一下调用堆栈,在里边找离崩溃最近的你自己写的函数,然后检查该函数,一般能分析出问题
char * ptr[MAX]; 没有初始化!