c-resources/CPlusPlus20ForProgrammers-m.../examples/ch06/fig06_01.cpp

41 lines
400 B
C++
Raw Normal View History

2024-04-23 08:25:49 +00:00
//variable scope
#include<iostream>
//global variable
//local variable
int k=0;
//function
//array
//struct
//class
//Macro
int main()
{ //block
cout<<k;
int k = 2;
int j=0;
{
int i=0;
2024-04-09 08:36:48 +00:00
}
2024-04-23 08:25:49 +00:00
cout<<k;
cout<<::k;
2024-04-09 08:36:48 +00:00
}
2024-04-23 08:25:49 +00:00
//definition
short 2B
unsigned int 4B
signed long 8B
2024-04-09 06:45:18 +00:00
2024-04-23 08:25:49 +00:00
1B = 0xFF
float
double
unsigned char
string
bool
int i=10;
//initialization
2024-04-09 06:45:18 +00:00
2024-04-23 08:25:49 +00:00
long b;
b=1200;
//assignement