#include<stdio.h>
#define COUNT 5
void enter(int *p_arr);
void report(int arr[], int count);
int main()
{
int arr[5];
int i;
for(i=0; i < COUNT; i++)
{
enter(&arr[i]);
}
report(arr, COUNT);
}
void enter(int *p_arr)
{
int i;
int insert;
printf("\nplease enter the number:");
scanf("%d", &insert);
p_arr[i]=insert;
}
void report(int arr[], int count)
{
int i;
printf("The numbers you have entered are:");
for(i=0; i< count; i++)
printf("\n%d", arr[i]);
}
Hello Guys.,
I'm new and learning C, when i compiled and ran this program on my mac in bash using gcc, it works... on our school server however it compiles but after the first entry it sais "Segmentation Error" and quits, any thoughts would be greatly appreciated!
Thanx!