意法半导体软件笔试真题(2)

招聘笔试题2018-11-22三水老师

  ..........

  void func(int *p)

  {...........}

  ..........

  main()

  {

  int num=0;

  .........

  func(&num);

  ........

  }

  ..........

  here, the function argument “&num” is passed .

  a. by value b. by reference

  iii. practice

  create a tree, which has h (h>0) layers, and its each node has w (w>0) sub-nodes.

  please complete the following incomplete solution.

  #include

  #include

  struct tree{

  char info;

  p_sub; //link to sub-nodes

  };

  // allocate memory and initiate

  void dnode ( struct tree* tmp )

  {

  =malloc( sizeof (struct tree) );

  = 0x41;

  = null;

  }

  struct tree *dtree (struct tree* subtree, int height, int width)

  {

  int i;

  if ( !subtree ) //if necessary, allocte memory for subtree

  denode(subtree);

相关推荐

猜你喜欢

大家正在看

换一换