此帖出自嵌入式系统论坛
最新回复
#include "stdio.h"#include "string.h"void loopmove(char* pstr,int steps){ int n=strlen(pstr)-steps; char tmp[10]; strcpy(tmp,pstr+n); strcpy(tmp+steps,pstr); *(tmp+strlen(pstr))='/0'; // it shoud be '\0' rather than '/0' = = strcpy(pstr,tmp);}int main(){ int steps=2; char pstr[]="abcdefg"; // you should not using a constant point string !!!loopmove(pstr, steps); printf(" zhegeshi %s/n",pstr); // here should be '\n' getchar(); return 0;}
详情
回复
发表于 2010-7-21 17:22
| ||
|
||
回复 楼主 sdg430 的帖子
此帖出自嵌入式系统论坛
| ||
个人签名处处留心皆学问!
|
||
此帖出自嵌入式系统论坛
| ||
|
||
曾经的版主且威望大于2000,或对EEWORLD论坛有突出贡献的坛友
EEWorld Datasheet 技术支持