赞
踩
C语言星号,当星号右侧是一个指针变量,星号和指针变量可看作一个整体,表示的是指针变量所指的内容;
C语言交换2个整数的程序;
- void CXkxkView::OnDraw(CDC* pDC)
- {
- CXkxkDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- // TODO: add draw code for native data here
- CString str1;
- int i1=9, i2=101;
-
- int * a = &i1;
- int * b = &i2;
-
- int temp = *a;
- *a = *b;
- *b = temp;
-
- str1.Format("%d",i1);
- pDC->TextOut(50, 50, str1);
- str1.Format("%d",i2);
- pDC->TextOut(50, 80, str1);
-
- int temp2 = (*a);
- (*a) = (*b);
- (*b) = temp2;
-
- str1.Format("%d",i1);
- pDC->TextOut(50, 140, str1);
- str1.Format("%d",i2);
- pDC->TextOut(50, 170, str1);
-
- int temp3 = (* a);
- (* a) = (* b);
- (* b) = temp3;
-
- str1.Format("%d",i1);
- pDC->TextOut(50, 230, str1);
- str1.Format("%d",i2);
- pDC->TextOut(50, 260, str1);
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。