当前位置:网站首页>Output of character pointer to string in C language
Output of character pointer to string in C language
2022-06-29 06:33:00 【The universe is hidden in the book】
The output of a string using a pointer of character type `
/* The use of pointers to achieve the assignment of strings */
#include<stdio.h>
char b[20];//global variable,
int main()
{
char a[]="xin nian kuai le";
void copy_char(char * p);
copy_char(a);
return 0;
}
/* Take character pointer type as parameter */
void copy_char(char * p)
{
int i;
for(i=0;*(p+i)!='\0';i++)//to judge if the character is '\0'
*(b+i)=*(p+i);
printf("after copied,this string is:\n");
for(i=0;*(b+i)!='\0';i++)
printf("%c",b[i]);
}
Output results :after copied,this string is:
xin nian kuai le
Process returned 0 (0x0) execution time : 0.120 s
Press any key to continue.
边栏推荐
- Personal blog item: processing of reading number +1 after viewing article details
- Client and server working modes of JVM
- Why can't the article be posted?
- Yyds dry goods inventory meituan's two-sided experience, and finally there was a surprise?
- Analysis comp122 the Caesar cipher
- Design and practice of kubernetes cluster and application monitoring scheme
- Fresnel diffraction with rectangular aperture based on MATLAB
- P5 DS - component and document Association
- Test Development - ten years of sharpening one sword (VII) interface test tool postman
- Illustrate plug-in -- AI plug-in development -- creative plug-in -- astute graphics -- multi axis mirroring function
猜你喜欢

Conditional test, if and case conditional test statements of shell script

Small program large screen adaptation Guide

Difference between URI and URL

Ctrip launched the "3+2" office mode. Are you sour?

RedisTemplate处理hash整数类型的问题解析
![[chromium] win10 vs2019 environment chromium configuration and compilation.](/img/20/428e6b22ed6955a732dd14d5ff0e3d.jpg)
[chromium] win10 vs2019 environment chromium configuration and compilation.

2022.02.14 - 239. A single element in an ordered array

Illustrate plug-in -- AI plug-in development -- creative plug-in -- astute graphics -- length and angle measurement function

Delete tag

Call the computer calculator and use it to convert several base numbers
随机推荐
Hyperledger Fabric 2. X custom smart contract
Design and practice of kubernetes cluster and application monitoring scheme
2,5-di (3,4-dicarboxyphenoxy) - 4 '- phenylethynylbiphenyldianhydride (pephqda) / Qiyue custom supply porphyrin modified amphiphilic block copolymer peg113-pcl46-porphyrin
QT (x): control operation
Mongodb paging method
Case of single file component files
[MySQL technology topic] technical analysis and guide for analyzing the high availability architecture of MySQL
Is there any difference between a=a+b and a+=b?
Hyperledger Fabric 2. X custom smart contract
National Defense University project summary
Installing modules in pycharm
Venn diagram proportional and color shading with semi transparency
QT (x): packaging and deployment
Difference between URI and URL
2022.02.15 - SX10-31. House raiding III
ASP. Net core 6 framework unveiling example demonstration [03]:dapr initial experience
Will the order of where conditions in MySQL affect the union index? Will where 1 =1 affect the use of the index? Does where 1 =1 affect the use of indexes?
Convert data frame with date column to timeseries
Fault: ntfrs warning log for id13562
Single application and microservice application