Search code examples
cmemorytabsspacecode-size

How tab and space affect code size in C


When working on embedded system, every byte of memory matters, in C/C++ program is there any difference in resulting code size when you use 4 space instead of 1 tab?


Solution

  • No.

    The emitted binary doesn't change based on what spacing you use in your program.

    The amount of space the source file takes up does change though. spaces and tabs are each one character, so using 1 tab vs 4 spaces takes up different amounts of memory. It's important to note that this is only for the source file, and during compilation.