Embedded System Question:

Explain Why cannot arrays be passed by values to functions?

Tweet Share WhatsApp

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 PDF Read All 21 Embedded System Questions
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?