是你最后输出的时候错了,也就是%2s这里,换成%c就好!你试试吧,希望能帮到你!
#include <stdio.h>
#include <string.h>
#include<stdlib.h>
void main()
{
char sz[] = {"#if !defined(AFX_STDAFX_H__6FE9C3E6_9E17_4973_BE60_201DABB00EFB__INCLUDED_"};
int i, j=0, max;
char str1[50];
char c;
max = strlen(sz)/6;
for(i=0; i < (sizeof(sz) - 1); i++)
{
if ((i+1)%6 == 0)
{
c = sz[i];
str1[j] = c;
j=j+1;
}
}
for(j = 0; j < max; j++)
{
printf("%c",str1[j]);
}
printf("\n");
}