you can see assembly code as an middle step, between the C code and the machine code. but you don't usually write assembly code yourself, the compiler translate it for you. C code -> [Compile] -> x86 assembly -> [Assemble] -> machine code you can if you want write assembly code yourself, and event mix it with C code
Damn, so in order to learn and run C, you also gotta learn Assembly as well?
no, you can skip it if you want
What is that [Compile]? Is there a type of compile?
by "Compile" I mean the step in the compiler that translate the C Code into assembly. The details of how a C code is compiled is complex. There are a lot of steps.
So there is only one type of compiler?
I don't understand the question. A compiler is a program that compile or "translate" if you like the code into assembly. There are many compilers on the market that you can use (for free). I think the most used is GCC for instance.
Ok, if this is how C code translates into machine language, C code -> [Compile] -> x86 assembly -> [Assemble] -> machine code How do you use compiler at the [Compile] part? And where do you download it from? Or once you download C language package(just like Python package), does compiler come with C package as well?
The latter statement, I see.
The latter statement, I see. So ther are many types of compilers.
Are you on windows or linux ?
I’m on MacOS
to use the compiler part you can either call it directly like this in a terminal gcc -o program.bin main.c This will take the C code in main.c and compile it into an executable "program.bin". in fact unless you ask otherwise the compiler program does the [Assembly] part as well by default. Or if you don't want to invoke the compiler yourself you can use a Makefile. You can also use an IDE like XCode on MacOS to make it easier.
you can ask the compiler to stop and don't do the Assembly part like this if you are interrested to see the assembly code. gcc -S main.c
It looks like the work of compiler can only be done on Terminal?
xcode bundles llvm/clang
Обсуждают сегодня