本次美国代写是C语言嵌入式开发系统的一个限时测试
1. Using the variable x, give definitions for the following:
(a) An integer
(b) A pointer to an integer
(c) An array of 10 integers
(d) An array of 10 pointers to integers
2. What is the output of the following C program?
#include <stdio.h>
int main ()
{
int vals[5] = {4, 3, 2, 5, 1};
int i;
for (i=0; i<=5; i++) {
printf(“vals[%d]=%d\n”, i, vals[i]);
}
return 0;
}
3. (a) What is the output of the following C program?
# include <stdio.h>
void fun(int y)
{
y = 30;
}
int main()
{
int y = 20;
fun(y);
printf(“%d”, y);
return 0;
}
(b) In the program above, is the variable y in main() stored on the stack or on the heap?
(c) What is the output of this C program?
# include <stdio.h>
void fun(int *y)
{
*y = 30;
}
int main()
{
int y = 20;
fun(&y);
printf(“%d”, y);
return 0;
}
(d) In the program above, is the variable y in main() stored on the stack or on the heap?
(e) True or false: &y in main() and y in fun() have the same value.