10??C++??????????????
???????????? ???????[ 2015/1/5 11:16:38 ] ????????C++ net
?????????????????????????????????????????
????char *c[] = {"ENTER"??"NEW"??"POINT"??"FIRST"};
????char **cp[] = { c + 3 ?? c + 2 ?? c + 1 ?? c};
????char ***cpp = cp;
????int main(void)
????{
????printf("%s"??**++cpp);
????printf("%s"??*--*++cpp+3);
????printf("%s"??*cpp[-2]+3);
????printf("%s
"??cpp[-1][-1]+1);
????return 0;
????}
???????
????c???????????飬?????????????char*????????????????Щ?????(??????)??
????c[0] = "ENTER"
????c[1] = "NEW"
????c[2] = "POINT"
????c[3] = "FIRST"
??????[]??*????????????????c[i]=*(c+i)??
????c??c+i????char *[]????????????????char **????????cp?????????????char **?????飬???????????
????cp[0] = c + 3
????cp[1] = c + 2
????cp[2] = c + 1
????cp[3] = c
???????ú??У?cp[0][0]=*(c + 3)=c[3]="FIRST"??????????
????cp??char **[]????????????????char ***??????????cpp????????char ***????????????????????????????????????????????????顣
????????????????????????????????
????printf("%s"??**++cpp);
????++cpp?????cp+1????????κ???cp[1]????????*cp[1]=c[2]="POINT"???????????
????printf("%s"??*--*++cpp+3);
??????++cpp?????cp+2???????????cp[2]=c+1??????????--????????c????????c[0]="ENTER"??+3?????????????"ER"???????"ER"
????printf("%s"??*cpp[-2]+3);
???????cpp?????cp+2??cpp[-2]=*(cpp-2)=*(cp+2-2)=cp[0]=c+3??????????c[3]="FIRST"??+3 ???????????"ST"???????"ST"
????printf("%s
"??cpp[-1][-1]+1);
????cpp????cp+2??cpp[-1]=*(cpp-1)=*(cp+2-1)=cp[1]=c+2????[-1]??*(c+2-1)=c[1]="NEW"??+1???????????"EW"???????"EW"??
????????
????#include <stdio.h>
????struct data
????{
????int a;
????unsigned short b;
????};
????int main(void)
????{
????data mData;
????mData.b = 0x0102;
????char *pData = (char *)&mData;
????printf("%d %d"?? sizeof(pData)?? (int)(*(pData + 4)));
????return 0;
????}
?????????4 2
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? “????”?????д????
????????????
?????????????????????????????????????????????????????
???????string?????????
????#include <iostream>
????#include <string>
????using namespace std;
????void chg_str(string str) {
????str = "ichgit";
????}
????int main() {
????string s = "sarrr";
????chg_str(s);
????printf("%s
"?? s.c_str());
????cout << s << endl;
????return 0;
????}
????????????“sarrr”??
?????????string???????????????????????????string?????????????????????????
????#include <iostream>
????#include <string>
????using namespace std;
????void chg_str(string *str) {
????*str = "ichgit";
????}
????int main() {
????string s = "sarrr";
????chg_str(&s);
????printf("%s
"?? s.c_str());
????cout << s << endl;
????return 0;
????}
????????????????
????#include <stdio.h>
????int sum(int a) {
????int c = 0;
????static int b = 3; // ???????
????c++;
????b += 2;
????return (a + b + c);
????}
????int main() {
????int i;
????int a = 2;
????for(i = 0; i < 5; ++i) {
????printf("%d
"?? sum(a));
????}
????return 0;
????}
?????????8 10 12 14 16
??????????洢?????????????????????????????????????????????γ?????????ó??????????У??????????к????????????????????????α????ú????μ????
???????????const???ε?????
?????????????????д??????????
????int GetInt(void)
????const int GetInt(void)
?????????????????????A ???????????????????
????A GetA(void)
????const A GetA(void)
????????????κ?????
?????????????????????????“???????”????????????????????????????洢????У???const ????????κμ?????????????????????????const?????????塣
?????????
????????????int GetInt(void) д??const int GetInt(void)??
????????????A GetA(void) д??const A GetA(void)??
??????????????????????const?????純??????????const&???Σ????????????????????????????д???????????
??????
???·???
??????????????????
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