Skip to content

Tag Archives: Macro & Preprocessor

In this article, we will discuss the difference between #define and #undef pre-processor in C language. Pre-Processor: Pre-processor is a program that performs before the… Read More
Pragma Directives: The pragma directive is used to control the actions of the compiler in a particular portion of a program without affecting the program… Read More
While programming in C++ we often use a class multiple times, and hence it requires to create a header file and just include it in… Read More
This directive is a special purpose directive and is used to turn on or off some features. These types of directives are compiler-specific i.e., they… Read More
errno is a preprocessor macro used for error indication.  The value of errno is set to zero at program startup, and any function of the… Read More
C/C++ Preprocessor directives basics Preprocessor directives: In almost every program we come across in C/C++, we see a few lines at the top of the… Read More
As the name suggests, Preprocessors are programs that process our source code before compilation. There are a number of steps involved between writing a program… Read More
What is the output for the following code snippet? #include<stdio.h> #define A -B #define B -C #define C 5    int main() {   printf("The value… Read More
#include <stdio.h> #define get(s) #s    int main() {     char str[] = get(GeeksQuiz);     printf("%s", str);     return 0; } (A) Compiler Error (B) #GeeksQuiz (C) GeeksQuiz… Read More
Output of following C program? #include<stdio.h> #define max abc #define abc 100    int main() {     printf("maximum is %d", max);     return 0; } (A) maximum… Read More
Predict the output of following program? #include <stdio.h> #define MAX 1000 int main() {    int MAX = 100;    printf("%d ", MAX);    return 0; } (A)… Read More
What is the use of \”#pragma once\”?  (A) Used in a header file to avoid its inclusion more than once.  (B) Used to avoid multiple… Read More
Which file is generated after pre-processing of a C program?  (A) .p  (B) .i  (C) .o  (D) .m  Answer: (B)Explanation: After the pre-processing of a… Read More
Output? #include<stdio.h>  #define f(g,g2) g##g2  int main()  {     int var12 = 100;     printf("%d", f(var,12));     return 0;  } (A) 100 (B) Compiler Error (C) 0 (D)… Read More
#include <stdio.h> #define a 10 int main() {   printf("%d ",a);      #define a 50      printf("%d ",a);   return 0; } (A) Compiler Error (B) 10… Read More

Start Your Coding Journey Now!