I'm learning programming and I can't make this script work. I opened 2 files and I want to go thru them and find out, if there are same or how many characters are different. But none of the cycles bellow work. Can you tell me, what I have done wrong? Thank you.
(I'm 100% sure that the problem lies here)
c and v should be of type int because EOF can't be represented by a char.
The first code looks more correct but it will fail to notice if the files have different sizes. If you want to increment diff once for each extra byte that the other file have you can just change the && to ||.
(In the first file there are 59 and in the second 62 chars) If I change && to || in first cycle it will sum characters from first and second file and it will display 121. "c" and "v" are integers.
No that is not what will happen. If the first 59 characters are the same in both files diff will be incremented 3 times, so if diff has value 0 before the loop it will have value 3 after it.