ポインタ
Posted: 2008年12月08日(月) 22:44
どうも、以前作成した下のプログラムで今はthe many peoplethe many peopleと出力されるのをthe many many peopleというように出力するようにしたいのですが、うまくいきません。うまくいくようにするにはどうすればよいでしょうか?お願いします。
#include<stdio.h> #define B 256 int main(void) { char str[/url]="the many people"; char ptr,*s,*p; int i=0; s=str; p=ptr; do{ (*(p+i)=*(s+i)); }while('\0'!=*(s+i++)); while(*p)p++; while(*p++=*s++); printf("%s\n",ptr); getchar (); getchar (); getchar (); return 0; }(/pre)