其中的 *p2=*p1; *p2='\0'; 作用是什么?
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/05/11 17:42:16
其中的 *p2=*p1; *p2='\0'; 作用是什么?
#include "stdafx.h"
#include
using namespace std;
int _tmain(int argc,_TCHAR* argv[])
{
\x05char str1[]="i love china!",str2[20],*p1,*p2;
\x05p1=str1;p2=str2;
for(;*p1!='\0';p1++,p2++)
\x05\x05*p2=*p1;
\x05*p2='\0';
\x05p1=str1;p2=str2;
\x05cout
#include "stdafx.h"
#include
using namespace std;
int _tmain(int argc,_TCHAR* argv[])
{
\x05char str1[]="i love china!",str2[20],*p1,*p2;
\x05p1=str1;p2=str2;
for(;*p1!='\0';p1++,p2++)
\x05\x05*p2=*p1;
\x05*p2='\0';
\x05p1=str1;p2=str2;
\x05cout
*p2=*p1; :
把str1[](*p1指向str1[])中的相应位上的字符赋值给str2(*p2指向str2[])
*p2='\0':
因为经过(p2++)此时*p2的值指向str2的末尾
'\0'标记str2结束,就像句号一样,是一位字符串数组更规范
把str1[](*p1指向str1[])中的相应位上的字符赋值给str2(*p2指向str2[])
*p2='\0':
因为经过(p2++)此时*p2的值指向str2的末尾
'\0'标记str2结束,就像句号一样,是一位字符串数组更规范
其中的 *p2=*p1; *p2='\0'; 作用是什么?
while(*p1) p1++; while(*p2) { *p1=*p2; p1++; p2++; } *p1=0;
p2->next=p1;p2=p1;
p1=p2; \\p1 的指针指向 p2,意味着p2值改变,p1值也改变
三阶实对称矩阵A特征值0,1,1,p1,p2是A的两不同特征向量,A(p1+p2)=p2,求Ax=p2的通解
指针的逻辑运算例题 inta[5]={1,3,5,7,9},*p1=a,*p2=0;那么 p1,p2,为真,p2,p1&
C++p1->next=p2;和p2=p1->next;是不是都代表p2指向p1的下一个地址?
p1+p2+p3+p4=1 0
k=*p1*(*p2)是什么意思?
p2->next=p1是什么意思
谁给讲解下其中的问题,函数如下swap(int *p1,int *p2) {int *p; p=p1; p1=p2; p
在线段AB上有两点P1、P2,其中P1分AB为AP1、P1B两部分,且AP1:P1B=5:7求P1、P2的距离