Here is my code, I submit it as C++ gcc 4.3.2 :
#include <stdio.h>
using namespace std;
void life (const int g, int* x)
{
for(int i=0; i<g; i++)
{
if(x[i]==42)
{
break;
}
printf("%d",x[i]);
printf("\n");
}
}
int main(int argc, char** argv) {
printf("Enter the number of inputs: ");
int num;
scanf("%d",&num);
const int inputNumber = num;
int* x;
x = new int [inputNumber];
printf("Enter each number, followed by Enter");
printf("\n");
for (int j=0; j<inputNumber; j++)
{
scanf("%d",&x[j]);
printf("\n");
}
life(inputNumber, x);
return 0;
}