1、如在在word表格中打钩

符号->其他符号->字体(wingdings2)

2、循环右移

方法1:

#include<stdio.h>
void move(char *s) //循环右移1位
{
if(s==NULL)
return;
char *p=s,*q=s;
char temp;
while(*p!='\0')
{
p++;
}
p--;
q=p-;
temp=*p;
while(p!=s)
{
*p=*q;
q--;
p--;
}
*s=temp;
}
void LoopMove( char *pStr,int steps)//循环右移steps位
{
int i=;
while(i<steps)
{
move(pStr);
i++;
}
}
void main()
{
char str[]="abcdef";
//char *str="abcdef"; 这里“abcdef”是常量,不能通过str指针修改常量值,这种写法错误
LoopMove(str,);
printf("%s",str);
}

方法2:strcpy不能人为控制拷贝的字节数,只是以‘\0’来

#include<stdio.h>
#include<string.h>
#include<malloc.h>
void LoopMove(char *pStr,int steps)
{
int len=strlen(pStr);
int n=len-steps;
char *temp=(char *)malloc(sizeof(char *));
strcpy(temp,pStr+n);
strcpy(temp+steps,pStr);
*(temp+len)='\0';
strcpy(pStr,temp);
} void main()
{
char str[]="abcdef";
LoopMove(str,);
printf("%s",str);
}

方法3:memcpy可以控制复制的字节数

#include<stdio.h>
#include<string.h>
#include<malloc.h>
void LoopMove(char *pStr,int steps)
{
int len=strlen(pStr);
int n=len-steps;
char *temp=(char *)malloc(sizeof(char *));
memcpy(temp,pStr+n,steps);//
memcpy(pStr+steps,pStr+steps,n);
memcpy(pStr,temp,steps);
} void main()
{
char str[]="abcdef";
LoopMove(str,);
printf("%s",str);
}

最新文章

  1. 从头开始构建LINUX[内核更新和资料]
  2. windows programming can&#39;t find windows.h
  3. linux下解压war文件命令
  4. ubuntu系统下的防火墙使用
  5. Rectangle(csu)
  6. noip赛前小结3
  7. Java虚拟机类加载机制——案例分析
  8. ubuntu双网卡bonding配置(转)
  9. Shell常用操作
  10. 取A表数据,关联B表任意一条数据
  11. 在UC浏览器上很炫的一个效果
  12. 【流量】netflow 基础知识
  13. 统一addEventListener与attachEvent中this指向问题
  14. UNIX环境高级编程——文件I/O
  15. UEFI Shell命令操作总结
  16. mongoDB3.4的sharding集群搭建及JavaAPI的简易使用
  17. 最简单的网络图片的爬取 --Pyhon网络爬虫与信息获取
  18. awk中使用shell的环境变量
  19. Java读取文件加锁代码Demo(利用Java的NIO)
  20. 单页面应用SPA和多页面应用MPA

热门文章

  1. PAT甲级——A1143 LowestCommonAncestor【30】
  2. VIP视频下载终结器
  3. 点读系列《流畅的python》
  4. PHP数组循环遍历的几种方式
  5. 使用 C++ 编写的基础 Windows 服务 (CppWindowsService)
  6. Linux NIO 系列(03) 非阻塞式 IO
  7. spring boot MVC
  8. [轉]C/C++中的volatile使用時機?
  9. 隐式激活Activity
  10. 在MVC4.5.1中使用Ninject