C Compiler Validation In this activity, you will program your first "Hello World" C program. Execution Execute this project according to the following guidelines: Validate the C compiler is installed: Start the Ubuntu virtual machine. Open up the Terminal Type gcc in the terminal prompt. You might see an error message indicating that 'gcc' is currently not installed. If 'gcc' is not installed, then run the following commands from the terminal prompt: sudo apt-get update sudo apt-get install gcc Type gcc again in the terminal prompt. You should see that gcc ran, but is looking for input files to compile. This is OK. Create your first C program: Open up the Text Editor application. Type in the following C program: (image at the bottom) Save the file as c into your Applications folder created on your desktop. Compile your program: Open the Terminal application. Enter the following command: gcc HelloWorld.c -oHelloWorld.out Run a list command (enter ls) from the terminal prompt. You should now see the compiled binary output called HelloWorld.out. Enter the following in the terminal prompt: ./HelloWorld.out This should print the "Hello World" message to the terminal/console window. Edit the HelloWorld.c file by changing the printf string to "Hello World.\n I now know how to compile and run a C program!", recompile the program, and run the program. What do you see different?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C Compiler Validation

In this activity, you will program your first "Hello World" C program.

Execution

Execute this project according to the following guidelines:

  1. Validate the C compiler is installed:
    1. Start the Ubuntu virtual machine.
    2. Open up the Terminal
    3. Type gcc in the terminal prompt. You might see an error message indicating that 'gcc' is currently not installed.
    4. If 'gcc' is not installed, then run the following commands from the terminal prompt:

sudo apt-get update

sudo apt-get install gcc

  1. Type gcc again in the terminal prompt. You should see that gcc ran, but is looking for input files to compile. This is OK.
  1. Create your first C program:
    1. Open up the Text Editor application.
    2. Type in the following C program:

(image at the bottom)

  1. Save the file as c into your Applications folder created on your desktop.
  2. Compile your program:
    1. Open the Terminal application.
    2. Enter the following command:

gcc HelloWorld.c -oHelloWorld.out

  1. Run a list command (enter ls) from the terminal prompt. You should now see the compiled binary output called HelloWorld.out.
  2. Enter the following in the terminal prompt:

./HelloWorld.out

  1. This should print the "Hello World" message to the terminal/console window.
  2. Edit the HelloWorld.c file by changing the printf string to "Hello World.\n I now know how to compile and run a C program!", recompile the program, and run the program. What do you see different?
/* Hello World program */
#include<stdio.h>
main ()
{
}
printf("Hello World\n");
Transcribed Image Text:/* Hello World program */ #include<stdio.h> main () { } printf("Hello World\n");
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education