C Identify the lines containing syntax or runtime errors in

C++: Identify the lines containing syntax or run-time errors in the code segment below. Select all that apply. Please provide explanation for answer.

A float burgerPrice -5.99, fryPrice - 3.99; B float *bp; C int *fp; *bp = 5.75; fp &fryPrice; F *fp=4; Answers: A

Solution

A)
   //No syntax error
   float burgerprice=5.99, fryPrice=3.99;
------------------------------------------------------------

B)

No syntax error
   //pointer to store address of float variable
   float *bp;
-----------------------------------------------------------

C)

No syntax error
   //pointer to store address of integer variable
   int *fp;

-----------------------------------------------------------
D )

No syntax or run time error
//Stores the value 5.75 at the pointer address of bp
   *bp=5.75;

---------------------------------------------

E)

Syntax error:
   //fp is integer type and fryPrice is of float
   //type .  
   //Type mismatch to store float type variable
   //address in integer type pointer.
   fp=&fryPrice;

---------------------------------------------
F)
   //No run time or syntax error
   *fp=4;

C++: Identify the lines containing syntax or run-time errors in the code segment below. Select all that apply. Please provide explanation for answer. A float bu

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site