CS Electrical And Electronics
@cselectricalandelectronics

Identify errors in following code

All QuestionsCategory: Cpp LanguageIdentify errors in following code
Anonymous asked 3 years ago

int val = 100;
const int *pc = &val;                //#2
*pc = 200;                               //#3
const int &rc = val;                 //#4
++rc;                                      //#5
int *ptr = pc;                           //#6
*ptr = 300;                              //#7
 
Options:
 

  1. Line no’s 3 & 5
  2. Line no’s 3, 5, & 6
  3. Line no’s 3, 5, & 7
  4. Line no 6 only