Thread: the role of preprocessor directives in c program

  1. #1
    Registered User
    Join Date
    Apr 2019
    Posts
    1

    the role of preprocessor directives in c program

    What is the role of preprocessor directives in c program? What if, we don't use it?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Apr 2019
    Posts
    1
    Preprocessor is a part of <<snipped spammy URL>> and are executed before compilation. This is a macro processor, which is used automatically by the C compiler to transform your program before actual compilation.


    In simple words, preprocessor directives tells the compiler to preprocess the source code before compiling. All the preprocessor commands are begin with "#" symbol.


    The most common use of the preprocessor is to include header files. In C and C++, all symbols must be declared in a file before they can used. They don’t always need to be defined*, but the compiler needs to know they exist somewhere. A preprocessor is just another technique to help a programming language be more useful. There are numerous techniques available and every language designer must choose the ones they like.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I smell a rat.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Preprocessor directives
    By Sonia in forum C Programming
    Replies: 2
    Last Post: 10-28-2010, 05:29 AM
  2. C/C++ preprocessor directives
    By coletek in forum C++ Programming
    Replies: 11
    Last Post: 01-11-2009, 04:24 PM
  3. Preprocessor Directives
    By Sentral in forum C++ Programming
    Replies: 3
    Last Post: 05-29-2005, 10:09 AM
  4. \ in preprocessor directives
    By shawn_drn in forum C Programming
    Replies: 1
    Last Post: 01-16-2005, 03:49 PM
  5. preprocessor directives
    By linuxdude in forum C Programming
    Replies: 1
    Last Post: 12-16-2003, 10:30 PM

Tags for this Thread