帮忙找个错误原因,谢谢
#include <cstdlib>#include <iostream>
using namespace std;
int fen(int chuan[],int n)
{
int i,j;
i=n;
for(j=0;i>0;i/=10,j++)
chuan[j]=i%10;
return j;
}
int main(int argc, char *argv[])
{
int chuan[1000];
int n=2432,j;
j=fen(chuan[],n); cout<<j<<"\n";
for(j=0;j<=1000;j++)
cout<<chuan[j];
return 0;
}
我想把数字n分解到数组chuan[]中,如n=123
则chuan[]={3,2,1}