Wednesday 23 May 2018

Compile and Run a c program in Ubuntu/linux

  1. Open a file using the command vi filename.c
  2. Write the c program and save the file
  3. Compile the program using the command.
     gcc -o filename filename.c
    This command will invoke the GNU C compiler to compile the file and create an executable called filename
  4. To execute the program type the command ./filename

Example
  1. vi hello.c
  2. gcc -o hello hello.c
  3. ./hello

No comments:

Post a Comment

list operations in python

How to make each term of an array repeat, with the same terms grouped together? i/p: [A,B,C] o/p: [A,A,A,B,B,B,C,C,C] Solution: >...