当前位置:网站首页>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.
边栏推荐
- Conditional test, if and case conditional test statements of shell script
- 2022-02 Microsoft vulnerability notification
- Programming specification and variables of shell script
- [MySQL technology topic] technical analysis and guide for analyzing the high availability architecture of MySQL
- Fresnel diffraction with rectangular aperture based on MATLAB
- Rich material libraries make modeling easy and efficient for developers
- Difference between static and final
- 关于 localStorage 的一些高阶用法
- 2022.02.14
- Linux Installation redis
猜你喜欢
![[C language series] - initial C language (4)](/img/3b/b20d6e0194f2114f8c27a17d58369a.jpg)
[C language series] - initial C language (4)

Illustrate plug-in -- AI plug-in development -- creative plug-in -- astute graphics -- multi axis mirroring function

Longest substring between two identical characters of leetcode simple question

Clickhouse data type

Failure: unable to log in to "taxpayer equity platform"

Small program large screen adaptation Guide

Yyds dry goods inventory meituan's two-sided experience, and finally there was a surprise?

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?

2,5-di (3,4-dicarboxyphenoxy) - 4 '- phenylethynylbiphenyldianhydride (pephqda) / Qiyue custom supply porphyrin modified amphiphilic block copolymer peg113-pcl46-porphyrin

CCTV revealed that xumengtao won the black Technology: there was a virtual coach???
随机推荐
Mongodb paging method
What are the uses of wireless pressure collectors?
Aging design guide for applets
Easy to understand TCP four waves (multi picture explanation)
DANGER! V** caught climbing over the wall!
[high concurrency] deeply analyze the callable interface
What are the uses of static?
[C language series] - initial C language (4)
Are there too many programmers in China at present?
Go compile source code (window environment)
QT (x): control operation
RedisTemplate处理hash整数类型的问题解析
Pytest (7) -yield and termination function
Fault: administrator account cannot be selected for login
Test Development - ten years of sharpening one sword (VII) interface test tool postman
力扣每日一题-第30天-1523.位1的个数
Sum of digits under k-ary representation of leetcode simple problem
Jenkins operation Chapter 6 mail server sending build results
Difference between static and final
The generation of leetcode simple questions each character is an odd number of strings