*与*&的问题。
void ptr(int* &t)
{
if(t==NULL)
{
t=new int;
*t=3;
cout<<*t<<endl;
}
else
{
*t=4;
cout<<*t<<endl;
}
}
int *t=NULL; //*t为空 这时候必须为(int* &t)才能修改原来*t的值。
cout<<*t<<endl;
ptr(t);
cout<<*t<<endl;
return 0;
//////////////////////////////////////////////////////
void ptr(int* t)
{
if(t==NULL)
{
t=new int;
*t=3;
cout<<*t<<endl;
}
else
{
*t=4;
cout<<*t<<endl;
}
}
int a=0;//*t不为空。
int*t=&a; //这时候可以不加&。
cout<<*t<<endl;
ptr(t);
cout<<*t<<endl;
return 0;
差别在*t为空或不为空,参数加不加&的问题。为什么?
{
if(t==NULL)
{
t=new int;
*t=3;
cout<<*t<<endl;
}
else
{
*t=4;
cout<<*t<<endl;
}
}
int *t=NULL; //*t为空 这时候必须为(int* &t)才能修改原来*t的值。
cout<<*t<<endl;
ptr(t);
cout<<*t<<endl;
return 0;
//////////////////////////////////////////////////////
void ptr(int* t)
{
if(t==NULL)
{
t=new int;
*t=3;
cout<<*t<<endl;
}
else
{
*t=4;
cout<<*t<<endl;
}
}
int a=0;//*t不为空。
int*t=&a; //这时候可以不加&。
cout<<*t<<endl;
ptr(t);
cout<<*t<<endl;
return 0;
差别在*t为空或不为空,参数加不加&的问题。为什么?
...全文
相关推荐
密码测试
*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?
正则表达式
%_\\+=&-]+$`。 - 密码强度验证:`^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$`。5.
Java各种验证的正则表达式
*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?
java正则表达式讲解
*[A-Z])(?=.*[a-z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?
JavaScript基于正则表达式的数字判断函数
4. `^-[0-9]*[1-9][0-9]*$`:这个正则表达式用于匹配负整数。`-`表示负号,其余部分与正整数正则相似。5. `^-?\\d+$`:这个正则表达式匹配整数,包括正整数、负整数和零。



