C Programming Language
C Programming Language
2nd Edition
ISBN: 9780131103627
Author: Brian W. Kernighan, Dennis M. Ritchie, Dennis Ritchie
Publisher: Prentice Hall
bartleby

Videos

Textbook Question
Book Icon
Chapter 1, Problem 1E

Run the “hello, world” program on your system. Experiment with leaving out parts of the program, to see what error messages you get.

Expert Solution & Answer
Check Mark
Program Plan Intro

To run the hello world program and experiment with leaving out parts of the hello world program, to see the error message.

Explanation of Solution

Program:

//Leaving out header file
//#include <stdio.h>
main()
{
printf("Hello, ");
	printf("World");
printf("\n");
}

Explanation:

The program above leaving the header file <stdio.h> statement to see the error. There is a warning in the program and shows the output.

Sample Output:

C Programming Language, Chapter 1, Problem 1E , additional homework tip  1

Program: 

#include <stdio.h>
//Leaving out main function
//main()
{
printf("Hello, ");
	printf("World");
printf("\n");
}

Explanation:

The program above leaving the main function to see the error. There is an error in program line 4.

Sample Output:

C Programming Language, Chapter 1, Problem 1E , additional homework tip  2

Program: 

#include <stdio.h>
main()
{
//Leaving out first statement line
//printf("Hello, ");
	printf("World");
printf("\n");
}

Explanation:

The program above leaving the first statement line to see the error. There is no error and print world, then a new line.

Sample Output:

C Programming Language, Chapter 1, Problem 1E , additional homework tip  3

Program: 

#include <stdio.h>
main()
{
printf("Hello, ");
//Leaving out second statement line
	//printf("World");
printf("\n");
}

Explanation:

The program above leaving the second statement line to see the error. There is no error and print hello, then a new line.

Sample Output:

C Programming Language, Chapter 1, Problem 1E , additional homework tip  4

Program: 

#include <stdio.h>
main()
{
printf("Hello, ");
	printf("World");
	//Leaving out third statement line
//printf("\n");
}

Explanation:

The program above leaving the third statement line to see the error. There is no error and print hello,world without a new line.

Sample Output:

C Programming Language, Chapter 1, Problem 1E , additional homework tip  5

Program: 

#include <stdio.h>
//Leaving out curley braces.

main()
//{
printf("Hello, ");
printf("World");
printf("\n");
//}

Explanation:

On leaving the curly braces the program will not compile and produce compilation error.

Sample Output:

C Programming Language, Chapter 1, Problem 1E , additional homework tip  6

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
Scenario You work for a small company that exports artisan chocolate. Although you measure your products in kilograms, you often get orders in both pounds and ounces. You have decided that rather than have to look up conversions all the time, you could use Python code to take inputs to make conversions between the different units of measurement. You will write three blocks of code. The first will convert kilograms to pounds and ounces. The second will convert pounds to kilograms and ounces. The third will convert ounces to kilograms and pounds. The conversions are as follows: 1 kilogram = 35.274 ounces 1 kilogram = 2.20462 pounds 1 pound = 0.453592 kilograms 1 pound = 16 ounces 1 ounce = 0.0283 kilograms 1 ounce = 0.0625 pounds For the purposes of this activity the template for a function has been provided. You have not yet covered functions in the course, but they are a way of reusing code. Like a Python script, a function can have zero or more parameters. In the code window you…
make a screen capture showing the StegExpose results
Which of the following is not one of the recommended criteria for strategic objectives? Multiple Choice   a) realistic   b) appropriate   c) sustainable   d) measurable
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
A+ Guide to Hardware (Standalone Book) (MindTap C...
Computer Science
ISBN:9781305266452
Author:Jean Andrews
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
The Top Down Approach to Software Development; Author: Christopher Kalodikis;https://www.youtube.com/watch?v=v9M8LA2uM48;License: Standard YouTube License, CC-BY