About this C comparison
In C, a changed constant or a renamed variable can be the difference between a working build and a subtle bug. Comparing the two versions of a source file shows each changed statement and marks the identifiers and literals that differ.
It is handy for reviewing a patch before you apply it, checking a student submission against a reference solution, or seeing what changed between two releases of a header.
What changed in this sample
- The variables
a,bandsumbecamex,yandresult, with new values 12 and 18. - The
printflabel changed from “Sum” to “Result”. - The threshold in the
ifmoved from 15 to 20, and both messages were updated to match.
Tips for comparing C
- Compare headers and sources
- Open a .h or .c file and C highlighting is picked automatically. Drop two files at once to fill both sides.
- Brace style changes
- If one file was reformatted with clang-format, turn on Ignore whitespace and Ignore blank lines to see only the code that changed.
- Line endings
- Code from Windows and Linux machines often differs only in CRLF versus LF. Line endings are never counted as changes, and you are told when they differ.
- Export a patch
- Download .diff file gives a unified diff you can apply with patch or git apply.
How to compare C online
- Paste the older version into Original and the newer one into Changed, or open a file on each side.
- Check that the syntax menu says C, then pick split or unified view.
- Step through the changes with the arrows or Alt ↓, and use Settings for options such as ignoring blank lines.
- Save the comparison in your browser, share a link, or download it as a .diff, HTML or PDF.
C comparison: questions
Can I compare two versions of a C file without git?
Yes. Paste or open both versions here and you get the same line-by-line view a git diff gives, plus word-level marks, without any repository.
Does it compile or check the code?
No. It only compares the text. Nothing is compiled or executed.
Can I compare preprocessor-heavy code?
Yes. Macros and #ifdef blocks are compared as text like any other line, and they are highlighted with C syntax colours.