C??C++??const?÷????????
???????????? ???????[ 2015/4/29 16:15:41 ] ????????C++ ??????? ??
?????????C??C++???????????????????????? ??????????????????????????Щī??????????????????????????????????????????????????? error?? ??????????????????????????
????1. ????????????????ú????????
1 #pragma warning(disable : 4090)
2
3 #include<stdio.h>
4
5 int main(int argv?? char args []) {
6
7 const int var = 4;
8 int *p = &var;
9 *p = 1;
10 printf("%d
"??var);
11 getchar();
12 }
???????????????? 1 ????????? C???????????C++???????????? p????????var??????????var??????
???????????????????????????????
1 #include<iostream>
2
3 using namespace std;
4
5 int main(int args ?? char argv[]) {
6
7 const int var = 10;
8 std::cout << "var =" << var << std::endl;
9 // int * p= &var; --??????????????
10 //?????????????
11 int *p = (int *)&var;
12 *p = 3;
13 std::cout << "*p =" << *p << std::endl;
14 int num[var];
15
16 int i = 0;
17 //?????
18 for (auto data : num) {
19 data =++i;
20 std::cout<<"num["<<i-1<<"] =" << data << std::endl;
21 }
22 getchar();
23 return 0;
24 }
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11