为啥结果有问题?

#include <string.h>
#include <stdio.h>

void IntToString(int nNum[], int nLen, char* cNum, char* sz_num[]);
void FindRepeatNumer(int nNum[], int nLen, char* sz_num[]);
int isSubString(char* pSub, char* sz_num[], int nLen);

int main(void)
{
	char cNum[1000] = {0};
	int arr_num[3] = {4, 11, 11};
	char* sz_num[100] = {NULL};
	
	IntToString(arr_num, 3, cNum, sz_num);
	FindRepeatNumer(arr_num, 3, sz_num);
}
void FindRepeatNumer(int nNum[], int nLen, char* sz_num[])
{
	char szNum[100] = {0};
	int i = 0;
	for(;i < nLen;++i)
	{
		IntToString(&nNum[i], 1, szNum, sz_num);
		if(isSubString(szNum, sz_num, nLen))
		{
			printf("repeatNumber:%d\n", nNum[i]);
		}
	}
}

/*
是否有子串
*/
int isSubString(char* pSub, char* sz_num[], int nLen)
{
	
	int nCount = 0;
	for(int i = 0;i < nLen;++i)
	{
		if(!strcmp(sz_num[i], pSub))
		{
			++nCount;
		}
	}
	if(nCount > 1)
	{
		return 1;
	}
	return 0;
}


void IntToString(int nNum[], int nLen, char* cNum, char* sz_num[])
{
	if(NULL == nNum) throw "无效数据!";
	int index = 0;
	char szStr[1000] = {0};
	int i = 0;
	
	for(;i < nLen;++i)
	{
		do
		{
			szStr[index] = nNum[i] % 10 +'0';
			++index;
		}while((nNum[i] /= 10) > 0);
		index = 0;
		if(nLen > 1)
		{
			char cTemp[4] = {0};
			int n = 0;
			for(int j = strlen(szStr)-1;j >=0 ;--j)
			{
				cTemp[n] = szStr[j];
				++n;
			}
			sz_num[i] = cTemp;
			
		}
		
	}
	for(int j = 0;j < 3;++j)
	{
		printf("%s\n", sz_num[j]);
	}
	i = 0;
	int nCnt = 0;
	for(i = index - 1;i >= 0;--i)
	{
		*(cNum+nCnt) = szStr[i];
		++nCnt;
	}
	
}


哪位知道错在哪了?调了半天。。。。。。。

你可能感兴趣的:(C++,c,C#,J#)