Am very close to working out all the kinks and need help with one last thing. This code is a simplified version of what am going to do.
Code:
int main()
{
char string1[] = "abc";
char string2[] = "abd";
int i,k;
for(i=0; i<3; i++){
for(k=0; k<3; k++){
if(string1[i] == string2[k]){
printf("%c", string2[k]);
<----------------------- THIS IS WHERE I want the array to take in the values that pass the if statement.
}
}
}
return 0;
}
Now I can't just place a simple array in there since its in a for loop, every time a new value passes the if statement the array will only get overwritten. Basically I need to keep stacking values into an array in a loop but not every time the loop is run. How can this be done?