What are some of the facts about preprocessor directives? - ProProfs Discuss
Advertisement

What are some of the facts about preprocessor directives?

What are some of the facts about preprocessor directives?<br/>

Change Image    Delete

Asked by Allcompiler, Last updated: Nov 21, 2024

+ Answer
Request
Question menu
Vote up Vote down

5 Answers

Bergeront Tiffney

Bergeront Tiffney

Here for the daily dose of fresh knowledge

Bergeront Tiffney
Bergeront Tiffney, Computer Engineer, M. Tech, Southeast Montgomery

Answered Oct 08, 2020

When we use include directive, the contents of the included header file (after processing) are copied to the existing file. Preprocessor directives are lines incorporated in a program that begins with the character number, making them different from a typical source code text.

Preprocessor directives alter the source code's text and the outcome is a new source code minus these directives. A preprocessor directive is typically positioned at the top of the source code in a separate line beginning with the character #, followed by a directive name and a free white space.

A comment on the same line of the preprocessor directive declaration has to be employed and cannot scroll through the following line: delimited comments cannot be used.

upvote downvote
Reply 

G. Horace

G. Horace

G. Horace
G. Horace, Content Developer, Chicago

Answered Sep 28, 2020

What many people don't know is that there are certain things you need to consider and take note of apart from writing codes. This is so true about preprocessor directives. Although preprocessor directives are not codes themselves, they must be included to get things done.

Preprocessor directives are used mostly during the compilation of source programs so that they can be changed easily. This will also give you an edge to change them to perform whatever actions you want. When you are writing the preprocessor directives, the first thing that must be on the line is the hash symbol (#), after which you can continue writing the directive.

You can also include space(s) between the hash symbol and the directive. Also, if you want to end the directive, what you should put at the end of the directive is a semi-colon. When you write a preprocessor directive, it will only affect the rest of the source program and not the ones before it.

upvote downvote
Reply 

G. Deacon

G. Deacon

Loves to build things that last longer.

G. Deacon
G. Deacon, Civil Engineer, B.E(Bachelor of Engineering), Trenton, New Jersey

Answered Sep 21, 2020

There are four main types of preprocessor directives.

These include Macros, File inclusion, conditional compilation, and other directives.

• Preprocessor directives are lines contained in a program that begins with the character number, which makes them different from standard source code text.

• They are invoked by the compiler to process some programs before compilation.

• A preprocessor command is a line of code placed inside a MOF file that controls the way that it assembles codes.

• These directives are typically used to make source programs easy to change and easy to compile in different situations.

• Directives in the supplier file tell the preprocessor to take specific actions. Before a C program is compiled, source code is processed by the preprocessor.

upvote downvote
Reply 

F. Daniel

F. Daniel

I work for a California based MNC.

F. Daniel
F. Daniel, Content Optimization Executive, Diploma in Journalism, California

Answered Sep 07, 2020

If a person is developing code, there are a number of facts about preprocessor directives that the user should know. First, these directives are lines that are not part of the coding. While they are not apart of the code, they are important because they are still read by the pre-processor.

During the reading, the processor finds the directive. Once they are ready, they are turned into another compilation. When they are written, the lines always will have a hash symbol in front of them. This symbol is #. While they begin with a hash, the directive will end with a semi-colon.

upvote downvote
Reply 

allcompiler

allcompiler

allcompiler
Allcompiler

Answered Jul 27, 2018

  • They end with a semicolon.
  • They are actually not the part of applications's code.
  • They always preceded with "#" symbol.
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.