Code:
char c *line, line2[20]
int index = 0;
strcpy(line2, "2 and 2 are 4");
c = line2[0];
line1 = (char *)malloc(15*sizeof(char));
while (c != '\0'
{
line1[index] = c; //c drops it's char onto the end of line1, first '2', then others
if (c = '2') printf("ok\n");
index = index+1; //index increments, so
c = line2[index]; //c can pick up another char from line2, here
};
line1[index-1]='\0';
printf("%s\n",line1);
In the red line of code, c is set equal to 2.
After that, in the loop in blue, c is used to "carry" the 2 (first), and then the rest of the line2 string, char by char, into line1.
It picks up it's char at the bottom of the loop, and drops it off at the top, when it's looping around.
C is the bucket, in the bucket brigade throwing water on the fire.