SlideShare a Scribd company logo
1 of 21
 Primitive Syntax :
 typedef existing-type new-name ;
 Examples:
Is this correct / valid?
How do I type define an String
 In the above declaration, SavingsAccount is
an Variable or Typedefinition?.
 P1 is pointer to const
 P2 is constant pointer
 P3 is constant pointer
 P4 is constant pointer
int main( )
{
#define PI 3.14
int r = 3;
float area = PI * r * r;
printf(" %f",area);
}
void calculateArea( );
int main( )
{
#define PI 3.14
calculateArea( );
}
void calculateArea( )
{
int r = 3;
float area = PI * r * r;
printf(" %f",area);
}
void calculateArea( );
int main( )
{
#define PI 3.14
int r = 3;
float area = PI * r * r;
printf(" %f",area);
calculateArea( );
}
void calculateArea( )
{
int r = 3;
float area = PI * r * r;
printf(" %f",area);
}
void calculateArea( );
int main( )
{
#define PI 3.14
int r = 3;
float area = PI * r * r;
printf(" %f",area);
#undef PI
calculateArea( );
}
void calculateArea( )
{
int r = 3;
float area = PI * r * r;
printf(" %f",area);
}
void calculateArea( );
int main( )
{
#define PI 3.14
int r = 3;
float area = PI * r * r;
printf(" %f",area);
calculateArea( );
#undef PI
}
void calculateArea( )
{
int r = 3;
float area = PI * r * r;
printf(" %f",area);
}
1. int main( )
2. {
3. int a = 5;
4. if( a )
5. printf(“if executed");
6. #if (a)
7. printf("#if executed");
8. #endif
9. }
a) Compilation Error in Line 6
b) Both printf are executed
c) Only the first pf is executed
1. #define a 0
2. int main( )
3. {
4. if( a )
5. {
6. #ifdef a
7. printf(“A")
8. #endif
9. }
10. }
a) No Error, No Output
b) Error in printf - ; missing
1. #define a 0
2. int main( )
3. {
4. if( a )
5. {
6. #if a
7. printf(“A")
8. #endif
9. }
10. }
#define MAYUR 0
int main( )
{
#if MAYUR
printf("#if executed");
#endif
#ifdef MAYUR
printf("#ifdef executed");
#endif
}
int main( )
{
#ifdef MAYUR
printf("#ifdef executed");
#endif
}
gcc file.c -DMAYUR

More Related Content

What's hot

Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in cSaranya saran
 
C programming pointer
C  programming pointerC  programming pointer
C programming pointerargusacademy
 
some basic C programs with outputs
some basic C programs with outputssome basic C programs with outputs
some basic C programs with outputsKULDEEPSING PATIL
 
ML: A Strongly Typed Functional Language
ML: A Strongly Typed Functional LanguageML: A Strongly Typed Functional Language
ML: A Strongly Typed Functional Languagelijx127
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4Saranya saran
 
Lab 9 sem ii_12_13
Lab 9 sem ii_12_13Lab 9 sem ii_12_13
Lab 9 sem ii_12_13alish sha
 
7segment scetch
7segment scetch7segment scetch
7segment scetchBang Igo
 
C Programming Language Part 9
C Programming Language Part 9C Programming Language Part 9
C Programming Language Part 9Rumman Ansari
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13alish sha
 
Lec14-CS110 Computational Engineering
Lec14-CS110 Computational EngineeringLec14-CS110 Computational Engineering
Lec14-CS110 Computational EngineeringSri Harsha Pamu
 
Learning C programming - from lynxbee.com
Learning C programming - from lynxbee.comLearning C programming - from lynxbee.com
Learning C programming - from lynxbee.comGreen Ecosystem
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)Syed Umair
 

What's hot (20)

Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in c
 
Ternary operator
Ternary operatorTernary operator
Ternary operator
 
Calculator in cpp
Calculator in cppCalculator in cpp
Calculator in cpp
 
C programming pointer
C  programming pointerC  programming pointer
C programming pointer
 
Ponters
PontersPonters
Ponters
 
Assignment10
Assignment10Assignment10
Assignment10
 
Semaphore
SemaphoreSemaphore
Semaphore
 
Semaphore
SemaphoreSemaphore
Semaphore
 
some basic C programs with outputs
some basic C programs with outputssome basic C programs with outputs
some basic C programs with outputs
 
ML: A Strongly Typed Functional Language
ML: A Strongly Typed Functional LanguageML: A Strongly Typed Functional Language
ML: A Strongly Typed Functional Language
 
C SLIDES PREPARED BY M V B REDDY
C SLIDES PREPARED BY  M V B REDDYC SLIDES PREPARED BY  M V B REDDY
C SLIDES PREPARED BY M V B REDDY
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 
Lab 9 sem ii_12_13
Lab 9 sem ii_12_13Lab 9 sem ii_12_13
Lab 9 sem ii_12_13
 
7segment scetch
7segment scetch7segment scetch
7segment scetch
 
C Programming Language Part 9
C Programming Language Part 9C Programming Language Part 9
C Programming Language Part 9
 
Lab 6
Lab 6Lab 6
Lab 6
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13
 
Lec14-CS110 Computational Engineering
Lec14-CS110 Computational EngineeringLec14-CS110 Computational Engineering
Lec14-CS110 Computational Engineering
 
Learning C programming - from lynxbee.com
Learning C programming - from lynxbee.comLearning C programming - from lynxbee.com
Learning C programming - from lynxbee.com
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
 

Similar to Questions typedef and macros

The solution manual of programming in ansi by Robin
The solution manual of programming in ansi by RobinThe solution manual of programming in ansi by Robin
The solution manual of programming in ansi by RobinShariful Haque Robin
 
Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2alish sha
 
Pointers in c - Mohammad Salman
Pointers in c - Mohammad SalmanPointers in c - Mohammad Salman
Pointers in c - Mohammad SalmanMohammadSalman129
 
miniLesson on the printf() function
miniLesson on the printf() functionminiLesson on the printf() function
miniLesson on the printf() functionChristine Wolfe
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solutionAnimesh Chaturvedi
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSKavyaSharma65
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1Little Tukta Lita
 
Chap 2 input output dti2143
Chap 2  input output dti2143Chap 2  input output dti2143
Chap 2 input output dti2143alish sha
 

Similar to Questions typedef and macros (20)

iit c prog.ppt
iit c prog.pptiit c prog.ppt
iit c prog.ppt
 
Ponters
PontersPonters
Ponters
 
Functions
FunctionsFunctions
Functions
 
ch08.ppt
ch08.pptch08.ppt
ch08.ppt
 
The solution manual of programming in ansi by Robin
The solution manual of programming in ansi by RobinThe solution manual of programming in ansi by Robin
The solution manual of programming in ansi by Robin
 
C programming
C programmingC programming
C programming
 
Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2
 
Unit2 C
Unit2 C Unit2 C
Unit2 C
 
Unit2 C
Unit2 CUnit2 C
Unit2 C
 
Pointers in c - Mohammad Salman
Pointers in c - Mohammad SalmanPointers in c - Mohammad Salman
Pointers in c - Mohammad Salman
 
miniLesson on the printf() function
miniLesson on the printf() functionminiLesson on the printf() function
miniLesson on the printf() function
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solution
 
Basics of c
Basics of cBasics of c
Basics of c
 
c programming
c programmingc programming
c programming
 
Chapter5.pptx
Chapter5.pptxChapter5.pptx
Chapter5.pptx
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERS
 
Ch 7-pointers
Ch 7-pointersCh 7-pointers
Ch 7-pointers
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
 
C programm.pptx
C programm.pptxC programm.pptx
C programm.pptx
 
Chap 2 input output dti2143
Chap 2  input output dti2143Chap 2  input output dti2143
Chap 2 input output dti2143
 

More from Mohammed Sikander (20)

Operator Overloading in C++
Operator Overloading in C++Operator Overloading in C++
Operator Overloading in C++
 
Python_Regular Expression
Python_Regular ExpressionPython_Regular Expression
Python_Regular Expression
 
Modern_CPP-Range-Based For Loop.pptx
Modern_CPP-Range-Based For Loop.pptxModern_CPP-Range-Based For Loop.pptx
Modern_CPP-Range-Based For Loop.pptx
 
Modern_cpp_auto.pdf
Modern_cpp_auto.pdfModern_cpp_auto.pdf
Modern_cpp_auto.pdf
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
 
Python exception handling
Python   exception handlingPython   exception handling
Python exception handling
 
Python tuple
Python   tuplePython   tuple
Python tuple
 
Python strings
Python stringsPython strings
Python strings
 
Python set
Python setPython set
Python set
 
Python list
Python listPython list
Python list
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
 
Pointer basics
Pointer basicsPointer basics
Pointer basics
 
Signal
SignalSignal
Signal
 
File management
File managementFile management
File management
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
CPP Language Basics - Reference
CPP Language Basics - ReferenceCPP Language Basics - Reference
CPP Language Basics - Reference
 
Java arrays
Java    arraysJava    arrays
Java arrays
 
Java strings
Java   stringsJava   strings
Java strings
 

Recently uploaded

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 

Recently uploaded (20)

Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 

Questions typedef and macros

  • 1.
  • 2.  Primitive Syntax :  typedef existing-type new-name ;  Examples:
  • 3.
  • 4. Is this correct / valid? How do I type define an String
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.  In the above declaration, SavingsAccount is an Variable or Typedefinition?.
  • 11.
  • 12.  P1 is pointer to const  P2 is constant pointer  P3 is constant pointer  P4 is constant pointer
  • 13. int main( ) { #define PI 3.14 int r = 3; float area = PI * r * r; printf(" %f",area); }
  • 14. void calculateArea( ); int main( ) { #define PI 3.14 calculateArea( ); } void calculateArea( ) { int r = 3; float area = PI * r * r; printf(" %f",area); }
  • 15. void calculateArea( ); int main( ) { #define PI 3.14 int r = 3; float area = PI * r * r; printf(" %f",area); calculateArea( ); } void calculateArea( ) { int r = 3; float area = PI * r * r; printf(" %f",area); }
  • 16. void calculateArea( ); int main( ) { #define PI 3.14 int r = 3; float area = PI * r * r; printf(" %f",area); #undef PI calculateArea( ); } void calculateArea( ) { int r = 3; float area = PI * r * r; printf(" %f",area); } void calculateArea( ); int main( ) { #define PI 3.14 int r = 3; float area = PI * r * r; printf(" %f",area); calculateArea( ); #undef PI } void calculateArea( ) { int r = 3; float area = PI * r * r; printf(" %f",area); }
  • 17. 1. int main( ) 2. { 3. int a = 5; 4. if( a ) 5. printf(“if executed"); 6. #if (a) 7. printf("#if executed"); 8. #endif 9. } a) Compilation Error in Line 6 b) Both printf are executed c) Only the first pf is executed
  • 18. 1. #define a 0 2. int main( ) 3. { 4. if( a ) 5. { 6. #ifdef a 7. printf(“A") 8. #endif 9. } 10. } a) No Error, No Output b) Error in printf - ; missing 1. #define a 0 2. int main( ) 3. { 4. if( a ) 5. { 6. #if a 7. printf(“A") 8. #endif 9. } 10. }
  • 19.
  • 20. #define MAYUR 0 int main( ) { #if MAYUR printf("#if executed"); #endif #ifdef MAYUR printf("#ifdef executed"); #endif }
  • 21. int main( ) { #ifdef MAYUR printf("#ifdef executed"); #endif } gcc file.c -DMAYUR

Editor's Notes

  1. #include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <iostream> int add(int a,int b) { return a + b; } int sub(int a,int b) { return a - b; } int (*myfunc(int ch))(int,int) { if(ch == 1) return add; else return sub; } int main( ) { int (*pf)(int,int) = myfunc(2); printf(" %d " , pf(3,6)); }
  2. #include <stdio.h> typedef struct Employee { int regNo; char name[20]; }; typedef struct { int accountNumber; char name[20]; int balance; }Account; typedef struct Node { int data; struct Node *link; }NODE_t; int main( ) { Account savingsAccount = {1 ,"abcd",5000}; struct Node *head; NODE_t *newNode; }