Warning: Undefined array key 1 in /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php on line 505

Warning: Undefined array key 2 in /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php on line 505

Warning: Cannot modify header information - headers already sent by (output started at /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php:505) in /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php on line 557

Warning: Cannot modify header information - headers already sent by (output started at /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php:505) in /home/yogindar/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php:505) in /home/yogindar/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php:505) in /home/yogindar/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php:505) in /home/yogindar/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php:505) in /home/yogindar/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php:505) in /home/yogindar/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php:505) in /home/yogindar/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php:505) in /home/yogindar/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1930
{"id":2189,"date":"2020-08-30T14:16:12","date_gmt":"2020-08-30T14:16:12","guid":{"rendered":"http:\/\/www.yogindar.com\/news\/?p=2189"},"modified":"2020-08-30T18:24:19","modified_gmt":"2020-08-30T18:24:19","slug":"compiling-a-c-program-various-stages-involved","status":"publish","type":"post","link":"http:\/\/blog.yogindar.org\/?p=2189","title":{"rendered":"Compiling a C program. Various stages involved."},"content":{"rendered":"

C is a high level programming language which converts a C code to executable which can be run in the respective target OS environment.<\/p>\n

Usually a C program code is written with an extension .c. An IDE or editor is used to add code to the programs. Once done a compiler is used to compile the program code to executable. Some IDE provide built-in compiler while others provide option to select the compiler and debugger.<\/p>\n

Steps involved in creating and executable.<\/p>\n

    \n
  1. Add code using an editor.<\/li>\n
  2. Compile using a compiler to create the executable binary. Linux uses gcc and windows uses Microsoft visual studio integrated compiler cl. There are other compilers available in multiple OS environments like borland C compiler.<\/li>\n
  3. Fix any coding issues and move to step 1. Otherwise go to step 4.<\/li>\n
  4. Run the final executable.<\/li>\n
  5. Fix and run time found issues and move to step 1. Otherwise go to step 6.<\/li>\n
  6. Final program ready.<\/li>\n<\/ol>\n

    The compilation phase can be split into 4.<\/p>\n

      \n
    1. Pre-processing phase.<\/li>\n
    2. Compilation phase.<\/li>\n
    3. Assembly phase.<\/li>\n
    4. Linking phase.<\/li>\n<\/ol>\n

      Pre-processing phase includes the following sub phases. This will generate filename.s file(in linux) which does have the below steps completed.<\/p>\n