SlideShare a Scribd company logo
 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 c
Saranya saran
 
Ternary operator
Ternary operatorTernary operator
Ternary operator
Hitesh Kumar
 
Calculator in cpp
Calculator in cppCalculator in cpp
Calculator in cpp
SitaramAgarwal
 
C programming pointer
C  programming pointerC  programming pointer
C programming pointer
argusacademy
 
Ponters
PontersPonters
Assignment10
Assignment10Assignment10
Assignment10
Sunita Milind Dol
 
some basic C programs with outputs
some basic C programs with outputssome basic C programs with outputs
some basic C programs with outputs
KULDEEPSING 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_4
Saranya 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 9
Rumman 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 Engineering
Sri Harsha Pamu
 
Learning C programming - from lynxbee.com
Learning C programming - from lynxbee.comLearning C programming - from lynxbee.com
Learning C programming - from lynxbee.com
Green 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

iit c prog.ppt
iit c prog.pptiit c prog.ppt
iit c prog.ppt
KauserJahan6
 
ch08.ppt
ch08.pptch08.ppt
ch08.ppt
NewsMogul
 
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
Shariful Haque Robin
 
C programming
C programmingC programming
C programming
Karthikeyan A K
 
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 Salman
MohammadSalman129
 
miniLesson on the printf() function
miniLesson on the printf() functionminiLesson on the printf() function
miniLesson on the printf() function
Christine Wolfe
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solution
Animesh Chaturvedi
 
Basics of c
Basics of cBasics of c
Basics of c
DebanjanSarkar11
 
c programming
c programmingc programming
c programming
Arun Umrao
 
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
KavyaSharma65
 
Ch 7-pointers
Ch 7-pointersCh 7-pointers
Ch 7-pointers
Muslimee Subhany
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1Little Tukta Lita
 
C programm.pptx
C programm.pptxC programm.pptx
C programm.pptx
SriMurugan16
 
Chap 2 input output dti2143
Chap 2  input output dti2143Chap 2  input output dti2143
Chap 2 input output dti2143
alish 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 CUnit2 C
Unit2 C
 
Unit2 C
Unit2 C Unit2 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

Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Mohammed Sikander
 
Operator Overloading in C++
Operator Overloading in C++Operator Overloading in C++
Operator Overloading in C++
Mohammed Sikander
 
Python_Regular Expression
Python_Regular ExpressionPython_Regular Expression
Python_Regular Expression
Mohammed Sikander
 
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
Mohammed Sikander
 
Modern_cpp_auto.pdf
Modern_cpp_auto.pdfModern_cpp_auto.pdf
Modern_cpp_auto.pdf
Mohammed Sikander
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
Mohammed Sikander
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
Mohammed Sikander
 
Python exception handling
Python   exception handlingPython   exception handling
Python exception handling
Mohammed Sikander
 
Python tuple
Python   tuplePython   tuple
Python tuple
Mohammed Sikander
 
Python strings
Python stringsPython strings
Python strings
Mohammed Sikander
 
Python set
Python setPython set
Python set
Mohammed Sikander
 
Python list
Python listPython list
Python list
Mohammed Sikander
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
Mohammed Sikander
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
Mohammed Sikander
 
Pointer basics
Pointer basicsPointer basics
Pointer basics
Mohammed Sikander
 
Pipe
PipePipe
Signal
SignalSignal
File management
File managementFile management
File management
Mohammed Sikander
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
Mohammed Sikander
 

More from Mohammed Sikander (20)

Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
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
 
Pipe
PipePipe
Pipe
 
Signal
SignalSignal
Signal
 
File management
File managementFile management
File management
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 

Recently uploaded

GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 

Recently uploaded (20)

GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 

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; }