SlideShare a Scribd company logo
C++: How many lines in the code segment below contain syntax errors? Please provide
explanation for answer, as in which lines and why. char*TowerofPower (char* Superman)
Superman "Kal-El"; = return Superman; int main () char tower = 'A', *ptr; ptr = Towe
rofPower(&tower;); return 0; Answers: 0 2 3
Solution
#include
#include
using namespace std;
char* TowerOfPower(char* Superman) //Defines a function which takes a character pointer as
input, and returns a character pointer.
{
Superman = "Kal-El"; //This leads to an warning. Superman is a pointer variable, and a string
constant cannot be assigned to this.
return Superman; //Returning a character pointer variable.
}
int main()
{
char tower = 'A', *ptr; //Declares a character variable tower initialized with 'A', and another
character pointer variable ptr.
ptr = TowerOfPower(&tower); //Calls the function TowerOfPower() with address of character
variable as input, and the returned value is stored in character pointer.
cout<<*ptr<

More Related Content

Similar to C++ How many lines in the code segment below contain syntax errors.pdf

U4.ppt
U4.pptU4.ppt
C++ Pointers with Examples.docx
C++ Pointers with Examples.docxC++ Pointers with Examples.docx
C++ Pointers with Examples.docx
JoeyDelaCruz22
 
Link list
Link listLink list
Link list
Malainine Zaid
 
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String ProcessingDynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Meghaj Mallick
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
Pranali Chaudhari
 
Lesson in Strings for C Programming Lessons
Lesson in Strings for C Programming LessonsLesson in Strings for C Programming Lessons
Lesson in Strings for C Programming Lessons
JamesChristianGadian
 
C++ Function
C++ FunctionC++ Function
C++ FunctionHajar
 
46630497 fun-pointer-1
46630497 fun-pointer-146630497 fun-pointer-1
46630497 fun-pointer-1
AmIt Prasad
 
Angular Pipes Workshop
Angular Pipes WorkshopAngular Pipes Workshop
Angular Pipes Workshop
Nir Kaufman
 
Week6_P_String.pptx
Week6_P_String.pptxWeek6_P_String.pptx
Week6_P_String.pptx
OluwafolakeOjo
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
ssuserd6b1fd
 
booksoncprogramminglanguage-anintroductiontobeginnersbyarunumrao4-21101016591...
booksoncprogramminglanguage-anintroductiontobeginnersbyarunumrao4-21101016591...booksoncprogramminglanguage-anintroductiontobeginnersbyarunumrao4-21101016591...
booksoncprogramminglanguage-anintroductiontobeginnersbyarunumrao4-21101016591...
GkhanGirgin3
 
Functions
FunctionsFunctions
Functions
PatriciaPabalan
 
presentation_functions_1443207686_140676.ppt
presentation_functions_1443207686_140676.pptpresentation_functions_1443207686_140676.ppt
presentation_functions_1443207686_140676.ppt
SandipPradhan23
 
Unit 4.pdf
Unit 4.pdfUnit 4.pdf
Unit 4.pdf
thenmozhip8
 

Similar to C++ How many lines in the code segment below contain syntax errors.pdf (20)

Strings in c++
Strings in c++Strings in c++
Strings in c++
 
U4.ppt
U4.pptU4.ppt
U4.ppt
 
C++ Pointers with Examples.docx
C++ Pointers with Examples.docxC++ Pointers with Examples.docx
C++ Pointers with Examples.docx
 
Link list
Link listLink list
Link list
 
Sql operators & functions 3
Sql operators & functions 3Sql operators & functions 3
Sql operators & functions 3
 
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String ProcessingDynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
 
Strings
StringsStrings
Strings
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Lesson in Strings for C Programming Lessons
Lesson in Strings for C Programming LessonsLesson in Strings for C Programming Lessons
Lesson in Strings for C Programming Lessons
 
C++ Function
C++ FunctionC++ Function
C++ Function
 
46630497 fun-pointer-1
46630497 fun-pointer-146630497 fun-pointer-1
46630497 fun-pointer-1
 
Angular Pipes Workshop
Angular Pipes WorkshopAngular Pipes Workshop
Angular Pipes Workshop
 
Week6_P_String.pptx
Week6_P_String.pptxWeek6_P_String.pptx
Week6_P_String.pptx
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Lecture5
Lecture5Lecture5
Lecture5
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
 
booksoncprogramminglanguage-anintroductiontobeginnersbyarunumrao4-21101016591...
booksoncprogramminglanguage-anintroductiontobeginnersbyarunumrao4-21101016591...booksoncprogramminglanguage-anintroductiontobeginnersbyarunumrao4-21101016591...
booksoncprogramminglanguage-anintroductiontobeginnersbyarunumrao4-21101016591...
 
Functions
FunctionsFunctions
Functions
 
presentation_functions_1443207686_140676.ppt
presentation_functions_1443207686_140676.pptpresentation_functions_1443207686_140676.ppt
presentation_functions_1443207686_140676.ppt
 
Unit 4.pdf
Unit 4.pdfUnit 4.pdf
Unit 4.pdf
 

More from nishadvtky

Find the complex zeros of the polynomial function. Write f in factor.pdf
Find the complex zeros of the polynomial function. Write f in factor.pdfFind the complex zeros of the polynomial function. Write f in factor.pdf
Find the complex zeros of the polynomial function. Write f in factor.pdf
nishadvtky
 
Enzymes are organic molecules that are essential raw materials for a.pdf
Enzymes are organic molecules that  are essential raw materials for a.pdfEnzymes are organic molecules that  are essential raw materials for a.pdf
Enzymes are organic molecules that are essential raw materials for a.pdf
nishadvtky
 
C++ 1.MAIN OBJECTIVEThe goal of this project is to design.pdf
C++ 1.MAIN OBJECTIVEThe goal of this project is to design.pdfC++ 1.MAIN OBJECTIVEThe goal of this project is to design.pdf
C++ 1.MAIN OBJECTIVEThe goal of this project is to design.pdf
nishadvtky
 
Can the peak to peak ripple current, IL, of a inductor be measured .pdf
Can the peak to peak ripple current,  IL, of a inductor be measured .pdfCan the peak to peak ripple current,  IL, of a inductor be measured .pdf
Can the peak to peak ripple current, IL, of a inductor be measured .pdf
nishadvtky
 
A statistic is a number describing an aspect of the scores in a samp.pdf
A statistic is a number describing an aspect of the scores in a samp.pdfA statistic is a number describing an aspect of the scores in a samp.pdf
A statistic is a number describing an aspect of the scores in a samp.pdf
nishadvtky
 
Angle in standavd position10pi7 =SolutionAn angle is in standa.pdf
Angle in standavd position10pi7 =SolutionAn angle is in standa.pdfAngle in standavd position10pi7 =SolutionAn angle is in standa.pdf
Angle in standavd position10pi7 =SolutionAn angle is in standa.pdf
nishadvtky
 
Dada la ecuacion de la conica -6x_1^2 + 20 x_1 x_2 + 8x_2^2 + 30 x_1.pdf
Dada la ecuacion de la conica  -6x_1^2 + 20 x_1 x_2 + 8x_2^2 + 30 x_1.pdfDada la ecuacion de la conica  -6x_1^2 + 20 x_1 x_2 + 8x_2^2 + 30 x_1.pdf
Dada la ecuacion de la conica -6x_1^2 + 20 x_1 x_2 + 8x_2^2 + 30 x_1.pdf
nishadvtky
 
Assume that a new oxygen-transport protein has been discovered in ce.pdf
Assume that a new oxygen-transport protein has been discovered in ce.pdfAssume that a new oxygen-transport protein has been discovered in ce.pdf
Assume that a new oxygen-transport protein has been discovered in ce.pdf
nishadvtky
 
You are lost in the national park of Bandrika. Tourists comprise 23.pdf
You are lost in the national park of Bandrika. Tourists comprise 23.pdfYou are lost in the national park of Bandrika. Tourists comprise 23.pdf
You are lost in the national park of Bandrika. Tourists comprise 23.pdf
nishadvtky
 
Describe in words the phylogenetic relationships among Eusthenoptero.pdf
Describe in words the phylogenetic relationships among Eusthenoptero.pdfDescribe in words the phylogenetic relationships among Eusthenoptero.pdf
Describe in words the phylogenetic relationships among Eusthenoptero.pdf
nishadvtky
 
Why do scientists refer to Charles Darwins ideas about evolution a.pdf
Why do scientists refer to Charles Darwins ideas about evolution a.pdfWhy do scientists refer to Charles Darwins ideas about evolution a.pdf
Why do scientists refer to Charles Darwins ideas about evolution a.pdf
nishadvtky
 
Which of the following terms refers to the ability to attend to cert.pdf
Which of the following terms refers to the ability to attend to cert.pdfWhich of the following terms refers to the ability to attend to cert.pdf
Which of the following terms refers to the ability to attend to cert.pdf
nishadvtky
 
Which system performs better using OFDM to service two different us.pdf
Which system performs better using OFDM to service two different us.pdfWhich system performs better using OFDM to service two different us.pdf
Which system performs better using OFDM to service two different us.pdf
nishadvtky
 
Which of the following is a method of reproduction that plants canno.pdf
Which of the following is a method of reproduction that plants canno.pdfWhich of the following is a method of reproduction that plants canno.pdf
Which of the following is a method of reproduction that plants canno.pdf
nishadvtky
 
What is an interface How is extending a class different from impl.pdf
What is an interface How is extending a class different from impl.pdfWhat is an interface How is extending a class different from impl.pdf
What is an interface How is extending a class different from impl.pdf
nishadvtky
 
Using Windows Batch in command prompt. - Call this programCreate a.pdf
Using Windows Batch in command prompt. - Call this programCreate a.pdfUsing Windows Batch in command prompt. - Call this programCreate a.pdf
Using Windows Batch in command prompt. - Call this programCreate a.pdf
nishadvtky
 
what are the consequences of HWE on allele and genotype frequencies.pdf
what are the consequences of HWE on allele and genotype frequencies.pdfwhat are the consequences of HWE on allele and genotype frequencies.pdf
what are the consequences of HWE on allele and genotype frequencies.pdf
nishadvtky
 
What are three major operating characteristics of air filtersSo.pdf
What are three major operating characteristics of air filtersSo.pdfWhat are three major operating characteristics of air filtersSo.pdf
What are three major operating characteristics of air filtersSo.pdf
nishadvtky
 
What are “nonsense syllables” and what is their importanceSolut.pdf
What are “nonsense syllables” and what is their importanceSolut.pdfWhat are “nonsense syllables” and what is their importanceSolut.pdf
What are “nonsense syllables” and what is their importanceSolut.pdf
nishadvtky
 
Three kinds of macromolecules are present in cell membranes. What ar.pdf
Three kinds of macromolecules are present in cell membranes. What ar.pdfThree kinds of macromolecules are present in cell membranes. What ar.pdf
Three kinds of macromolecules are present in cell membranes. What ar.pdf
nishadvtky
 

More from nishadvtky (20)

Find the complex zeros of the polynomial function. Write f in factor.pdf
Find the complex zeros of the polynomial function. Write f in factor.pdfFind the complex zeros of the polynomial function. Write f in factor.pdf
Find the complex zeros of the polynomial function. Write f in factor.pdf
 
Enzymes are organic molecules that are essential raw materials for a.pdf
Enzymes are organic molecules that  are essential raw materials for a.pdfEnzymes are organic molecules that  are essential raw materials for a.pdf
Enzymes are organic molecules that are essential raw materials for a.pdf
 
C++ 1.MAIN OBJECTIVEThe goal of this project is to design.pdf
C++ 1.MAIN OBJECTIVEThe goal of this project is to design.pdfC++ 1.MAIN OBJECTIVEThe goal of this project is to design.pdf
C++ 1.MAIN OBJECTIVEThe goal of this project is to design.pdf
 
Can the peak to peak ripple current, IL, of a inductor be measured .pdf
Can the peak to peak ripple current,  IL, of a inductor be measured .pdfCan the peak to peak ripple current,  IL, of a inductor be measured .pdf
Can the peak to peak ripple current, IL, of a inductor be measured .pdf
 
A statistic is a number describing an aspect of the scores in a samp.pdf
A statistic is a number describing an aspect of the scores in a samp.pdfA statistic is a number describing an aspect of the scores in a samp.pdf
A statistic is a number describing an aspect of the scores in a samp.pdf
 
Angle in standavd position10pi7 =SolutionAn angle is in standa.pdf
Angle in standavd position10pi7 =SolutionAn angle is in standa.pdfAngle in standavd position10pi7 =SolutionAn angle is in standa.pdf
Angle in standavd position10pi7 =SolutionAn angle is in standa.pdf
 
Dada la ecuacion de la conica -6x_1^2 + 20 x_1 x_2 + 8x_2^2 + 30 x_1.pdf
Dada la ecuacion de la conica  -6x_1^2 + 20 x_1 x_2 + 8x_2^2 + 30 x_1.pdfDada la ecuacion de la conica  -6x_1^2 + 20 x_1 x_2 + 8x_2^2 + 30 x_1.pdf
Dada la ecuacion de la conica -6x_1^2 + 20 x_1 x_2 + 8x_2^2 + 30 x_1.pdf
 
Assume that a new oxygen-transport protein has been discovered in ce.pdf
Assume that a new oxygen-transport protein has been discovered in ce.pdfAssume that a new oxygen-transport protein has been discovered in ce.pdf
Assume that a new oxygen-transport protein has been discovered in ce.pdf
 
You are lost in the national park of Bandrika. Tourists comprise 23.pdf
You are lost in the national park of Bandrika. Tourists comprise 23.pdfYou are lost in the national park of Bandrika. Tourists comprise 23.pdf
You are lost in the national park of Bandrika. Tourists comprise 23.pdf
 
Describe in words the phylogenetic relationships among Eusthenoptero.pdf
Describe in words the phylogenetic relationships among Eusthenoptero.pdfDescribe in words the phylogenetic relationships among Eusthenoptero.pdf
Describe in words the phylogenetic relationships among Eusthenoptero.pdf
 
Why do scientists refer to Charles Darwins ideas about evolution a.pdf
Why do scientists refer to Charles Darwins ideas about evolution a.pdfWhy do scientists refer to Charles Darwins ideas about evolution a.pdf
Why do scientists refer to Charles Darwins ideas about evolution a.pdf
 
Which of the following terms refers to the ability to attend to cert.pdf
Which of the following terms refers to the ability to attend to cert.pdfWhich of the following terms refers to the ability to attend to cert.pdf
Which of the following terms refers to the ability to attend to cert.pdf
 
Which system performs better using OFDM to service two different us.pdf
Which system performs better using OFDM to service two different us.pdfWhich system performs better using OFDM to service two different us.pdf
Which system performs better using OFDM to service two different us.pdf
 
Which of the following is a method of reproduction that plants canno.pdf
Which of the following is a method of reproduction that plants canno.pdfWhich of the following is a method of reproduction that plants canno.pdf
Which of the following is a method of reproduction that plants canno.pdf
 
What is an interface How is extending a class different from impl.pdf
What is an interface How is extending a class different from impl.pdfWhat is an interface How is extending a class different from impl.pdf
What is an interface How is extending a class different from impl.pdf
 
Using Windows Batch in command prompt. - Call this programCreate a.pdf
Using Windows Batch in command prompt. - Call this programCreate a.pdfUsing Windows Batch in command prompt. - Call this programCreate a.pdf
Using Windows Batch in command prompt. - Call this programCreate a.pdf
 
what are the consequences of HWE on allele and genotype frequencies.pdf
what are the consequences of HWE on allele and genotype frequencies.pdfwhat are the consequences of HWE on allele and genotype frequencies.pdf
what are the consequences of HWE on allele and genotype frequencies.pdf
 
What are three major operating characteristics of air filtersSo.pdf
What are three major operating characteristics of air filtersSo.pdfWhat are three major operating characteristics of air filtersSo.pdf
What are three major operating characteristics of air filtersSo.pdf
 
What are “nonsense syllables” and what is their importanceSolut.pdf
What are “nonsense syllables” and what is their importanceSolut.pdfWhat are “nonsense syllables” and what is their importanceSolut.pdf
What are “nonsense syllables” and what is their importanceSolut.pdf
 
Three kinds of macromolecules are present in cell membranes. What ar.pdf
Three kinds of macromolecules are present in cell membranes. What ar.pdfThree kinds of macromolecules are present in cell membranes. What ar.pdf
Three kinds of macromolecules are present in cell membranes. What ar.pdf
 

Recently uploaded

2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 

Recently uploaded (20)

2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 

C++ How many lines in the code segment below contain syntax errors.pdf

  • 1. C++: How many lines in the code segment below contain syntax errors? Please provide explanation for answer, as in which lines and why. char*TowerofPower (char* Superman) Superman "Kal-El"; = return Superman; int main () char tower = 'A', *ptr; ptr = Towe rofPower(&tower;); return 0; Answers: 0 2 3 Solution #include #include using namespace std; char* TowerOfPower(char* Superman) //Defines a function which takes a character pointer as input, and returns a character pointer. { Superman = "Kal-El"; //This leads to an warning. Superman is a pointer variable, and a string constant cannot be assigned to this. return Superman; //Returning a character pointer variable. } int main() { char tower = 'A', *ptr; //Declares a character variable tower initialized with 'A', and another character pointer variable ptr. ptr = TowerOfPower(&tower); //Calls the function TowerOfPower() with address of character variable as input, and the returned value is stored in character pointer. cout<<*ptr<