Hi, I wrote some piece of code that should have been printf the parts of input.Let me give an example since my english not enough to explain it . If user give an input like A 7638 2303. since its starts with 'A' code should give me 7638 and 2303 one by one.I tried to it and wrote a code like that but output is nothing.It does not give error or warning but also it does not give any output just a blank.Where am i wrong please help me : (
Code:#include<stdio.h> int main(){ char input1[129],input2[129]; char text[260]; int i,j; fgets(text,260,stdin); if(text[0]=='A'){ for(i=2; ;i++){ if(text[i]==' '){ j=i; printf("%d \n",i); break; } else{ input1[i]=text[i];} } while(text[j]!='\0'){ input2[j]=text[j]; j+=1;} } printf("%s %s \n",input1,input2); return 0; }



LinkBack URL
About LinkBacks


