C 基礎筆記1

2022-03-10 15:52:50 字數 2656 閱讀 1947

1.

轉義字元

字元形變數

輸出32~127

之間的所有字元

4.

寬字元的輸出

#include

#include

using

namespace std; 

intmain() 

5.

各整型的長度及數值範圍

浮點型變數

float

浮點型變數

雙精度浮點型變數

例子:#include

#include

//setprecision

函式要求包含此標頭檔案

using

namespace std; 

intmain() 

7.

列舉型別常量

#include

using

namespace std; 

intmain() 

; day today; 

today=monday; 

if (today==sunday||today==saturday) 

else

cout<

工作日\n"; 

return

0; }

8.

內聯函式

即使用關鍵字

inline

宣告函式,說明如下:

成員函式

10.

建構函式與析構函式

陣列物件

#include

using

namespace std; 

class a  

; a::a() 

a::~a() 

intmain() 

12.

堆記憶體操作

#include

using

namespace std; 

intmain() 

13.

記憶體洩漏

變數

指標的常見錯誤

#include

using

namespace std; 

intmain() 

輸出結果:

16.

常量指標(

int* const p=new int

17.

指向常量的指標(

const int* p=new int

18.

指向常量的常指標(

const int* const p=new int

C 基礎筆記1

1.轉義字元 2.字元形變數 3.輸出32 127 之間的所有字元 4.寬字元的輸出 include include using namespace std intmain 5.各整型的長度及數值範圍 6.浮點型變數 float 浮點型變數 double 雙精度浮點型變數 例子 include in...

c 基礎筆記 1 列舉

定義列舉一般不用中文,就像sql的欄位名一樣,效率會有影響,下面就實現為列舉值添自定義中文說明,然後獲取。1.建立乙個類,既然要新增自定義屬性,就必須繼承attribute public class enumhelper attribute public string description 2.建...

PHP基礎筆記(1)

1.在 php 中,所有變數都對大小寫敏感。2.變數的作用域 local 區域性 global 全域性 static 靜態 1 函式之外宣告的變數擁有 global 作用域,只能在函式以外進行訪問。2 函式內部宣告的變數擁有 local 作用域,只能在函式內部進行訪問。3.x 5 y 10 func...