prev | Character Arrays - String manipulations: 93. Position after each line and print them (14.05.2010) /* Program# 93 date : 10-01-2009 Position after each line -In array and print array */ #include <stdio.h> main(){ char a[100]; int i,j=0; int pos[100]; i=0; scanf("%c",&a[i]); while(a[i]!='$'){ i++; scanf("%c",&a[i]); } a[i]='\0'; i=0; while(a[i]!='\0'){ if(a[i]=='\n'){ pos[j++]=i+1; } i++; } //end array pos[j]=-1; j=0; while(pos[j]!=-1){ printf("\n %d",pos[j++]); } } |
next |