Consider the following ANSI C function:
Let Z be an array of 10 elements with , for all such that . The value returned by SimpleFunction (Z, 10, 2) is _________.
c
Programming in CFunctions, Parameter Passing, Scope Rules, RecursionNAT2 marksMedium
1int SimpleFunction (int Y[ ], int n, int x)
2{
3 int total = Y[0], loopIndex;
4 for (loopIndex = 1; loopIndex <= n - 1; loopIndex++)
5 total = x * total + Y[loopIndex];
6 return total;
7}
8A GATE question every morning
One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.