S
silverchrono
this is my first semester in C
and im trying to figure out how to reset a counter.
heres why im trying to do.
void text()
59 printf("You can end entering the text by using '#'\n");
60 int i=0;
61 int j=0;
62 int k=0;
63 while ((tx=getchar())!='#')
64 {
65 i++;
66 }
67
68 while(tx[j]!='\0')
69 {
70 putchar(tx[j]+cc[k]);
74 k++; j++;
//basically I want [j] to keep on counting until EOF a// no problem
there
//but i want k to count only from 0 to 2 then resets back to 0 again
then 1 then 2, then resets to 0 again Until EOF...now i have a good
reason why i want k to count from 0 to 2 only and resets to 0
anyone have a clue on how to do this thx.
and im trying to figure out how to reset a counter.
heres why im trying to do.
void text()
59 printf("You can end entering the text by using '#'\n");
60 int i=0;
61 int j=0;
62 int k=0;
63 while ((tx=getchar())!='#')
64 {
65 i++;
66 }
67
68 while(tx[j]!='\0')
69 {
70 putchar(tx[j]+cc[k]);
74 k++; j++;
//basically I want [j] to keep on counting until EOF a// no problem
there
//but i want k to count only from 0 to 2 then resets back to 0 again
then 1 then 2, then resets to 0 again Until EOF...now i have a good
reason why i want k to count from 0 to 2 only and resets to 0
anyone have a clue on how to do this thx.