Embedded System Question:
Download Questions PDF

Explain Why cannot arrays be passed by values to functions?

Answer:

Because in C when you say the name of the array it means the address of the first element.
example :
int a[];
func (a);
int func(int a[]);

In this when you call the function by passing the argument a actually &a[0](address of first element) gets passed. Hence it is impossible to pass by value in C.

Download Embedded System Interview Questions And Answers PDF

Previous QuestionNext Question
What are the advantages and disadvantages of using macro and inline functions?Explain what is interrupt latency? How can we reduce it?