2016年嵌入式面试C语言试题【精选】

2016-10-22 00:00:00嘉辉 嵌入式培训

  第1题: 考查对volatile关键字的认识

  #include

  static jmp_buf buf;

  main()

  {

  volatile int b;

  b =3;

  if(setjmp(buf)!=0)

  {

  printf("%d ", b);

  exit(0);

  }

  b=5;

  longjmp(buf , 1);

  }

  请问, 这段程序的输出是

  (a) 3

  (b) 5

  (c) 0

  (d) 以上均不是

  第2题:考查类型转换

  main()

  {

  struct node

  {

  int a;

  int b;

  int c;

  };

  struct node s= { 3, 5,6 };

  struct node *pt = &s;

  printf("%d" , *(int*)pt);

  }

  这段程序的输出是:

  (a) 3

  (b) 5

  (c) 6

  (d) 7

  第3题:考查递归调用

  int foo ( int x , int n)

  {

  int val;

  val =1;

  if (n>0)

  {

  if (n%2 == 1) val = ..........

阅读全文
 1/2    1 2 下一页 尾页

[嵌入式培训]相关推荐

[嵌入式培训]相关栏目推荐
查看更多
上一篇:2017嵌入式系统开发工程师考试综合编程题 下一篇:2017嵌入式系统开发工程师考试模拟试题