The function gets reads characters from the stream stdin up to the next newline character, and stores them in the string s. The newline character is discarded (note that this differs from the behavior of fgets, which copies the newline character into the string). If gets encounters a read error or end-of-file, it returns a null pointer; otherwise it returns s.
Warning: The gets function is very dangerous because it provides no protection against overflowing the string s. The GNU library includes it for compatibility only. You should always use fgets or getline instead. To remind you of this, the linker (if using GNU ld) will issue a warning whenever you use gets.
int main()
{
int a=891237489;
int digits;
int i;
int *p;
if( ( p=(int *)malloc(10*sizeof(int)) )==NULL ){
printf("allocation fail!");
exit(EXIT_FAILURE);
}
digits=get_digits(a,p);
printf("the digits of %d is: %d\n",a,digits);
for(i=0;i<digits;++i){
printf("[%d] is: %d\n",i,p[i]);
}