欧美日韩在线免费观看,久久精品合集精品视频,每日更新在线观看AV_手机,这里是精品中文字幕

<mark id="47rz2"><center id="47rz2"><dd id="47rz2"></dd></center></mark>

    <legend id="47rz2"><u id="47rz2"><blockquote id="47rz2"></blockquote></u></legend>

      當(dāng)前位置:好文網(wǎng)>職場指南>筆試>筆試題循環(huán)

      筆試題循環(huán)

      時間:2024-07-28 15:51:55 筆試 我要投稿
      • 相關(guān)推薦

      筆試題(循環(huán))

      三、簡答題(25分)
      1、頭文件中的 ifndef/define/endif 干什么用?
      2、#include %26<filename.h%26> 和
      #include "filename.h" 有什么區(qū)別?
      3、const 有什么用途?(請至少說明兩種)
      4、在C++ 程序中調(diào)用被 C編譯器編譯后的函數(shù),
      為什么要加 extern "C"聲明?
      5、請簡述以下兩個for循環(huán)的優(yōu)缺點
      // 第一個for (i=0; i%26<N; i++)
      {if (condition)
      DoSomething();
      else
      DoOtherthing();}
      優(yōu)點:缺點:
      // 第二個if (condition)
      {for (i=0; i%26<N; i++)
      DoSomething();}
      else{
      for (i=0; i%26<N; i++) DoOtherthing();}
      優(yōu)點:缺點:
      四、有關(guān)內(nèi)存的思考題(20分)
      void GetMemory(char *p)
      {
      p = (char *)malloc(100);
      }
      void Test(void)
      {
      char *str = NULL;GetMemory(str);
      strcpy(str, "hello world");
      printf(str);
      }請問運行Test函數(shù)會有什么樣的結(jié)果?答:
      char *GetMemory(void)
      {
      char p[] = "hello world";
      return p;
      }
      void Test(void)
      {
      char *str = NULL;
      str = GetMemory();
      printf(str);
      }
      請問運行Test函數(shù)會有什么樣的結(jié)果?答:
      Void GetMemory2(char **p, int num)
      {
      *p = (char *)malloc(num);
      }
      void Test(void)
      {
      char *str = NULL;
      GetMemory(%26str, 100);
      strcpy(str, "hello");
      printf(str);
      }
      請問運行Test函數(shù)會有什么樣的結(jié)果?答:
      void Test(void)
      {
      char *str = (char *) malloc(100);
      strcpy(str, "hello");
      free(str);
      if(str != NULL)
      {
      strcpy(str, "world");
      printf(str);
      }
      }
      請問運行Test函數(shù)會有什么樣的結(jié)果?答:
      五、編寫strcpy函數(shù)(10分)
      已知strcpy函數(shù)的原型是
      char *strcpy(char *strDest, const char *strSrc);
      其中strDest是目的字符串,strSrc是源字符串。
      (1)不調(diào)用C++/C的字符串庫函數(shù),請編寫函數(shù) strcpy
      (2)strcpy能把strSrc的內(nèi)容復(fù)制到strDest,為什么還要char * 類型的返回值?
       

      筆試題(循環(huán))

      【筆試題循環(huán)】相關(guān)文章:

      360筆試題01-20

      12580筆試題01-20

      筆試-CRI 2010筆試題01-19

      《水循環(huán)》教案02-21

      《水循環(huán)》教案07-03

      循環(huán)小數(shù)教案04-04

      《水循環(huán)》教學(xué)反思08-04

      循環(huán)小數(shù)教案03-26

      《循環(huán)小數(shù)》教案03-03