in Programming in C closed by
389 views
0 votes
0 votes
closed with the note: bad question, implementation details not given

in Programming in C closed by
389 views

2 Answers

2 votes
2 votes
The concept involved in the question is that arrays are passed by pointers and so when we pass an array to fun() we will actually be passing a pointer of that array.
The answer to this question would depend on the implementation of data types by the machine/compiler and amount of bytes given to each.As per the solution it seems they have taken pointers as 4 bytes and integers as 2 bytes. So arr_size evaluates to 2 ,(notice that even though syntax of fun(int arr[]) when passed would be converted to a pointer int *arr and its size would be 4 bytes.)
so as arr_size evaluates to 2 first 2 elts will get printed.
1 vote
1 vote

Hope this helps :) 

by

Related questions

0 votes
0 votes
0 answers
4