1#include <stdio.h>2#include <stdlib.h>3 4 voidMain ()5 {6 intReadi ();7 Char*READC ();8 voidWriteChar* Read,inti);9 Ten intI=0; One Char* read001=READC (); AI=Readi (); -printf"%s\n", read001); - write (read001,i); the if((GetChar ()) = ='\ n') - GetChar (); - } - intReadi () { + intI=0; -printf"input I"); +scanf"%d",&i); A return(i); at } - Char*READC () { - intA=0, b=Ten, c=1; -printf"input Character"); - Char* Read001= (Char*)malloc(Ten*sizeof(Char)); - while(c) { inread001[a]=GetChar (); - if(a==b-1){ to Char* read002=read001; +b=b+Ten; - Char* Read001= (Char*)malloc(b*sizeof(Char)); the for(intk=0; k<b- One; k++){ *read001[k]=Read002[k]; $ }Panax Notoginseng } - if(read001[a]=='\ n') theC=0; +a=a+1; A } theread001[a-1] =' /'; + returnread001; - } $ voidWriteChar* Read,inti) { $ Char* Write= (Char*)malloc(i*sizeof(Char)); - Static intA=0; - for(; a<i+1; a++){ the if(read[a]==' /'){ - Break;Wuyi } thewrite[a]=Read[a]; - } Wu for(; a<i+1; a++){ -write[a]='m'; About } $write[a-1]=' /'; -printf"%s", write); -}
C Language Learning-0004 string copy