主题:问个问题,关于ifdef,帮帮忙啊,谢谢了
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
//#define DEBUG
/*enum BOOL {TRUE, FALSE};
using namespace std;
namespace printA
{
print()
{
cout<<"using namespace printA….."<<endl;
};
}
namespace printB
{
print()
{
cout<<"using namespace printB….."<<endl;
};
}
void main()
{
BOOL falg;
printA::print(); //测试命名空间printA, ::是作用域解析运算符
printB::print();
falg=TRUE;
}*/
typedef struct
{
int core;
char v;
}std;
void add(int t)
{
t=1+2;
}
void add_1(int &t)
{
t=1+2;
}
void swap(int *x, int *y )
{
int temp;
temp = *x;
*x =*y;
*y = temp ;
}
void swapp(int x, int y )
{
int temp;
temp = x;
x =y;
y = temp ;
}
void main()
{
std *p;
p=new std[3];
p->core=4;
p->v='a';
p++;
p->core=4;
p->v='b';
p++;
p->core=4;
p->v='c';
char c[5];
char *x;
// *x='a';
for(int i=0;i<5;i++)
c[i]='a'+i;
int t;
add(t);
i=t;
add_1(t);
int j=t;
int a=3,b=4;
swap(&a,&b);
printf("%d, %d\n",a,b);
#ifdef DEBUG
printf("device_open(%p) ", c);
#endif
cout<<"***********************"<<endl;
int n=3,m=4;
swapp(n,m);
printf("%d, %d\n",n,m);
return;
}
我想请问#ifdef DEBUG
printf("device_open(%p) ", c);
这是什么意思呢?[em2][em2][em2]
#include <stdlib.h>
#include <iostream.h>
//#define DEBUG
/*enum BOOL {TRUE, FALSE};
using namespace std;
namespace printA
{
print()
{
cout<<"using namespace printA….."<<endl;
};
}
namespace printB
{
print()
{
cout<<"using namespace printB….."<<endl;
};
}
void main()
{
BOOL falg;
printA::print(); //测试命名空间printA, ::是作用域解析运算符
printB::print();
falg=TRUE;
}*/
typedef struct
{
int core;
char v;
}std;
void add(int t)
{
t=1+2;
}
void add_1(int &t)
{
t=1+2;
}
void swap(int *x, int *y )
{
int temp;
temp = *x;
*x =*y;
*y = temp ;
}
void swapp(int x, int y )
{
int temp;
temp = x;
x =y;
y = temp ;
}
void main()
{
std *p;
p=new std[3];
p->core=4;
p->v='a';
p++;
p->core=4;
p->v='b';
p++;
p->core=4;
p->v='c';
char c[5];
char *x;
// *x='a';
for(int i=0;i<5;i++)
c[i]='a'+i;
int t;
add(t);
i=t;
add_1(t);
int j=t;
int a=3,b=4;
swap(&a,&b);
printf("%d, %d\n",a,b);
#ifdef DEBUG
printf("device_open(%p) ", c);
#endif
cout<<"***********************"<<endl;
int n=3,m=4;
swapp(n,m);
printf("%d, %d\n",n,m);
return;
}
我想请问#ifdef DEBUG
printf("device_open(%p) ", c);
这是什么意思呢?[em2][em2][em2]