久久综合丝袜日本网手机版,日韩欧美中文字幕在线三区,亚洲精品国产品国语在线,极品在线观看视频婷婷

      <small id="aebxz"><menu id="aebxz"></menu></small>
    1. 華為全套面試題基礎(chǔ)版1

      時間:2022-07-11 15:55:46 面試 我要投稿
      • 相關(guān)推薦

      華為全套面試題(基礎(chǔ)版)1

      1。什么是預(yù)編譯,何時需要預(yù)編譯:

      華為全套面試題(基礎(chǔ)版)1

      答案:1、總是使用不經(jīng)常改動的大型代碼體。

      2、程序由多個模塊組成,所有模塊都使用一組標(biāo)準(zhǔn)的包含文件和相同的編譯選項。在這種情況下,可以將所有包含文件預(yù)編譯為一個預(yù)編譯頭。

      2。char * const p

      char const * p

      const char *p

      上述三個有什么區(qū)別?

      答案:

      char * const p; //常量指針,p的值不可以修改

      char const * p;//指向常量的指針,指向的常量值不可以改

      const char *p; //和char const *p

      3。char str1[] = "abc";

      char str2[] = "abc";

      const char str3[] = "abc";

      const char str4[] = "abc";

      const char *str5 = "abc";

      const char *str6 = "abc";

      char *str7 = "abc";

      char *str8 = "abc";

      cout << ( str1 == str2 ) << endl;

      cout << ( str3 == str4 ) << endl;

      cout << ( str5 == str6 ) << endl;

      cout << ( str7 == str8 ) << endl;

      結(jié)果是:0 0 1 1

      str1,str2,str3,str4是數(shù)組變量,它們有各自的內(nèi)存空間;

      而str5,str6,str7,str8是指針,它們指向相同的常量區(qū)域。

      4。以下代碼中的兩個sizeof用法有問題嗎?[C易]

      void UpperCase( char str[] ) // 將 str 中的小寫字母轉(zhuǎn)換成大寫字母

      {

      for( size_t i=0; i

      if( a<=str[i] && str[i]<=z )

      str[i] -= (a-A );

      }

      char str[] = "aBcDe";

      cout << "str字符長度為: " << sizeof(str)/sizeof(str[0]) << endl;

      UpperCase( str );

      cout << str << endl;

      答案:函數(shù)內(nèi)的sizeof有問題。根據(jù)語法,sizeof如用于數(shù)組,只能測出靜態(tài)數(shù)組的大小,無法檢測動態(tài)分配的或外部數(shù)組大小。函數(shù)外的str是一個靜態(tài)定義的數(shù)組,因此其大小為6,因為還有\(zhòng)