#include <stdio.h> #include <stdlib.h> /* Ferworn W04. program to ask user how big they want an array. Dump fives into it and call a function to output the array */ void output(int array[],int size); void main() { int size,j; int *block; printf("Enter the size of the array you want: "); scanf("%d",&size); block = (int *) malloc(size * sizeof(int)); if(block == NULL) exit(0); /* malloc() returns NULL if no memory was allocated */ for(j=0;j<size;j++) *(block + j) = 5; output(block,size); } void output(int array[],int size) { int j; for(j=0;j<size;j++) printf("%d ",array[j]); }