Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  12
Language: C/C++
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
     int n;
     printf("How many numbers you want to enter?");
     scanf("%d",&n);
     while(n<0)
     {printf("Error!");
     scanf("%d",&n);
     }
     int *p=(int*)malloc(n*4);
     if(p==NULL)
     {printf("out of memory!");
     return 1;
     }
     printf("Enter numbers:");
     int i;
     for(i=0;i<n;i++)
          scanf("%d",p+i);
     
     
     return 0;
}
          
Comments: