What is ## Preprocessor Directive in C?

This C Tutorial explains how Directive “##” Works. Like “#” construct “##” construct can be used in the replacement text of function like macro or object like macro. This macro combines two tokens on either side of it into a single token called an identifier. Let’s recall that a token is a group of words … Read more

advertisement

#error, #pragma and #null Directives in C

This C Tutorial explains #error, #pragma and #null Directives in C and How are they Used in C Programs. #error directive let’s you display error massage for some test condition. For ex., /* err_dir.c– program shows a way to use #error directive */ #include <stdio.h>   /* YES and NO defined */ #define YES #define … Read more

advertisement

What is Nested File Inclusion in C Programming?

Question: What is Nested File Inclusion in C? Answer: In simple terms #include containing other #include directives included in the program. For ex., /* sll.h */ #include <stdio.h> #include <stdlib.h>   #define BUFFSIZE 512   /* function declarations to be used in a program */ void sum2ints(const int, const int); void sum2floats(const float, const float); … Read more

advertisement

What is File Inclusion in C?

This C Tutorial explains File Inclusion in C programming. #include causes the contents of another file to be compiled as if they actually appeared in place of the #include directive. The way this substitution is performed is simple, the Preprocessor removes the directive and substitutes the contents of the named file. Compiler allows two different … Read more

advertisement

Why we use #include Directive in C Program?

Question13: Why #include Directive is required in a C Program? Answer: #include files are called header files as they contain declarations for family of functions, say, printf(), scanf() etc., and declarations for #defined symbols, say EOF (end of file) etc.. As we know that compiler supports two types of #includes in C programs, these are, … Read more

advertisement

What is Nested Directive in C?

This C Tutorial explains Nested Directives in C programming. Let’s see an example of nested directives to understand them, /* nested_dir.c– program illustrate nested directives */ #include <stdio.h> #define YES #define NO   #undef YES #undef NO   int main(void) { /* let’s test if YES and NO are defined or not */ /* use … Read more

advertisement

Conditional Compilation in C

This C Tutorial explains Conditional Compilation in C programming. Well! We all know that while debugging the source code of a program, we generally include printf() statements at several places of doubts to know until where has been execution going correct, until where have been if the values of required variables evaluated correctly? These statements … Read more

advertisement

Command Line Macro Definitions in C

This C Tutorial explains Command Line Macro Definitions in C programming. Linux gcc compiler provides the ability to define symbols on command line that initiates the compilation. This feature is useful when compiling different versions of a program from the same source file. For ex. size of an array on a machine with small memory … Read more

advertisement

#if, #elif and #else Directives in C

This C Tutorial explains how #if, #elif and #else Directives works. We are familiar with if (conditional exp.) { /* statements */ } else if (conditional exp.) { /* other statements */ } else { /* other statements */ } construct which branches program execution depending on condition evaluation. But these construct affect program execution … Read more

advertisement

What is #undef Directive in C Programs?

Question: What is #undef Directive and What is this used for in C Programs? Answer: #undef directive undefines a previously defined #define. For example, #define LIMIT 100   #undef LIMIT Preprocessor undefines LIMIT by removing its definition. Even if we haven’t defined LIMIT, for ex., #define LIMIT It’s possible to undefine it. #undef LIMIT Notice … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.