Interview Questions and Answers :: Hewlett Packard Enterprise
Home > Experience Archives > Hewlett Packard Enterprise > Interview Question Set 1 > Discussion
4. Find out the mistake done in below program, and fix it.
void array-init(int *arr)
{
arr = malloc (4*sizeof (int));
arr[1] = 10;
arr[0] = 20;
}
int main()
{
int *p = NULL;
array-init(p);
printf("%d", p[0]);
printf("%d", p[1]);
return 1;
}
Answer:
No Discussion on this question yet!
No Discussion on this question yet!