0

Here is the problem:write in saparate function without using global variable

1/(function input)enter N in the range [0,20], then enter N numbers

2/(function display)Display N numbers in 2 columns

Here is my source code

```
#include<stdio.h>
#include<conio.h>
void Input(int *p,int n)
{
int i;
do
{
printf("Enter N numbers u want to input: ");
scanf("%d",&n);
}while ( (n<0) || (n>20) );
p =(int *)malloc(n*sizeof(int));
printf("Ennter %d numbers: ",n);
for( i=0; i<n; i++)
{
printf("\nNumber%: ",i);
scanf("%d",p+i);
}
}
void Display(int *p, int n)
{
int i;
printf("test");
for( i=0; i<n; i++)
{
printf(" %d",p[i]);
}
}
int main()
{
int *a, *N;
Input(a,&N);
Display(a,&N);
getch();
return 0;
}
```

I don't know how can I use the variable N in function input for the next function.

*Edited 7 Years Ago by thebluestar*: n/a