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
How would you go about figuring out what caused a problem with the computer in the first place?
Give an overview of the program and talk about how it can be tested.
How would you go about determining what caused the problem with the computer and correcting it after you've found it?

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
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.
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
The Top Down Approach to Software Development; Author: Christopher Kalodikis;https://www.youtube.com/watch?v=v9M8LA2uM48;License: Standard YouTube License, CC-BY