I just made a 'Hello World' program

#include<stdio.h>
int main()
{
	printf("Hello World\n");
    return 0;
}
exe file size    = 15.5 KB
Source file size = 79.0  B

Then i made a data structure program (implementing stack, queue, deque)

exe file size    = 21.9 KB
Source file size = 17.3 KB

So i guess it's not linearly dependent with its source file
So what really decides the size of an exe file.
PS - I think it is also compiler dependent 'coz exe files on turbo c++ are larger compared to those of code blocks

>>So what really decides the size of an exe file.
Your compiler. Two different compilers using the same identical code can produce different exe sizes. And the same compiler can produce different exe sizes depending on the flags you give it, such as DEBUG and UNICODE, and the way it might optimize or not optimize the code.

And if you include 'resource files' to your application, the size will go up about the size of the files you include in it. As AD said, it's very often different because of the compiler and settings.

And the same compiler can produce different exe sizes depending on the flags you give it, such as DEBUG and UNICODE

What are these DEBUG and UNICODE? Can you give me an example?

And if you include 'resource files' to your application, the size will go up

By resource files, do you mean to say header files?

What are these DEBUG and UNICODE? Can you give me an example?

If the compiler is set up to produce a debug executable (to allow the programmer to debug the program easier), then there's more information and instructions packed into the executable which would increase its size.

UNICODE is a type of character, normally a character in C++ is one byte, but if UNICODE is defined, then you would be using a two byte characters (capable of holding thousands more characters to support chinese and other types of symbols.

By resource files, do you mean to say header files?

By resource files, I mean files with the .res extensions which allow you to internally attach files such as images or videos into the executable. Nothing to do with header files.

The file size is dependant on so many things, If i statically link all the applications dependencies, then the program can turn from 10kb to 60kb.

UNICODE is a type of character, normally a character in C++ is one byte, but if UNICODE is defined, then you would be using a two byte characters (capable of holding thousands more characters to support chinese and other types of symbols

Ohh, that UNICODE! Thanks +1

I mean files with the .res extensions which allow you to internally attach files such as images or videos into the executable.

I don't know much about them (time to Google!) but can this(.res files) be done using just a C compiler? Like we do in HTML.

This question has already been answered. Start a new discussion instead.