

It is here to help you to communicate with the computer. This is done with the help of a compiler.Ĭompiler is a program that translates a source file into an executable file.Ī compiler is a translator.
#How to create a makefile for c program from commandline code#
To run a program written in the C programming language, you need to translate its source code into executable code. This is called executable code, or simply a language that computers understand. It isn't even textual: if you open it in Notepad++ you'll only see seemingly meaningless numbers and characters (give it a try!). In contrast to a source file, an executable file is not human-readable. They are designed to be both human-readable and easily translatable to something a computer could execute.Įxecutable file is a file which can be executed by a computer. Programming languages are created to help human beings to tell the machines what they would like them to do. In this module, we will use the Notepad++ editor, which provides C syntax highlighting. These files can be browsed with any text editor. c file extension is nothing more than a hint for you and the computer for distinguishing files containing C programs from regular plain text files with. c, for example program.c (or hello.c as in the above tutorial). These files usually have names ending with. Let's take a closer look on what they mean.Ĭ source file is a plain text file containing a program in the C programming language. This tutorial has possibly introduced you to some new concepts. Stay tuned! As a simple exercise, try to modify the program so that it actually prints your name instead of the text "Your name". To compile and execute your program you need to get to the directory C:/Users/b1234567/EEE1008/ by changing your current directory with the cd (stands for change directory) command.Ĭongratulations! You have just written, compiled and executed your first C program! It's alright for now if you have no idea what's going on, soon it will all become clear.

Remember you had to take note of its location? Let's assume its location is C:/Users/b1234567/EEE1008/hello.c.

Navigate to your program with Cygwin Terminal The first option you get is likely to be the Cygwin64 Terminal - this is what you need. You can do that in a similar way you did with Notepad++: hit you Win key and type Cygwin. We will be using the GCC compiler as a command line application, so we need to access the command line (also known as terminal). In the next step we will use the GCC compiler to get an executable file. To do that, we need to translate out program into the form computers understand and execute. We need to make the computer to execute it. Once the first program has been written, we want to find out what it actually does. You must carefully note the location of the saved file, it should be something like C:/Users/b1234567/EEE1008/hello.c, where b1234567 is your student number. Yes, this is your first C program! Now you can save the file somewhere, choosing C source file in the Save as type drop-down menu, and naming it hello.c. * hello.c A first program in C */ #include int main()
