![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
lonely_gfolf
这个作者很懒,什么都没留下…
展开
-
省略号表示参数个数可变
#include <iostream> using namespace std; #define TRUE 1 #define FALSE 0 #define N 2+3 int fun(int x, ...) { return x; } int main() { int n; n = fun(1,2,3); cout << n <...原创 2018-05-08 21:58:55 · 306 阅读 · 0 评论 -
a = '1' 与 a = 1的区别
#include <iostream> using namespace std; int fun(int x, ...) { char a = '252'; cout << a <<endl; int b; b = a; return b; } int main() { int n; n = fun(1...原创 2018-05-09 15:53:30 · 1671 阅读 · 0 评论 -
算术运算操作数类型有误
C++语言中的运算分为有符号和无符号运算,执行算数运算时,如果操作数的类型不同,在运算过程中,编译器会自动转换操作数类类型,使其一致。这种转换因编程语言的标准不同,其转换方式也各异。#include <iostream> using namespace std; int fun(int x, ...) { unsigned char a = 254; signed ...原创 2018-05-09 16:07:21 · 532 阅读 · 0 评论 -
冒泡排序法重温
#include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; /*自己预测 5,4,3,2,1 4,3,2,1,5 i = 0 j < 4 3,2,1,4,5 i = 1 j < 3 2,1,3,4,5 i = 2 j < 2 1,2,3,4,5 ...原创 2018-05-13 22:42:43 · 118 阅读 · 0 评论 -
统一区域内变量重名
#define TRUE 1 #define FALSE 0 #define PI 3.1455 void fun() { int a = 0; bool b = true; if(b) { int a = 100; a = a + 1; } cout << a << endl; } int m...原创 2018-05-08 16:26:48 · 166 阅读 · 0 评论 -
#define的边缘效应
#include <iostream> using namespace std; #define TRUE 1 #define FALSE 0 #define N 2+3 void fun() { double a = 3.0/2; double b = N/2; double c = double(N)/2; double d = 3/2; ...原创 2018-05-08 16:37:52 · 810 阅读 · 0 评论 -
将False定义为1
#include <iostream> using namespace std; #define FALSE 1 void fun() { if (false) { cout << "hello1" << endl; } if (FALSE) { cout << "hello...原创 2018-05-08 16:43:39 · 494 阅读 · 0 评论 -
拼接窄的和宽的字符串
#include <iostream> using namespace std; #define TRUE 1 #define FALSE 0 #define N 2+3 void fun() { wchar_t arrayj[] = L"Hello" L"wrold"; char a[] = "aa" "sfd"; cout << a &原创 2018-05-08 17:26:54 · 351 阅读 · 0 评论