Join Examsbook
764 0

Q: Point out the error in the following program. main() {     char mybuf[] = "Zanzibar" ;     char yourbuf[] = " Zienckewiz";     char * const ptr = mybuf;      *ptr = 'a';      ptr = yourbuf; }

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

ptr pointer is constant. In ptr = yourbuf the program is trying to modify it, hence an error.

Are you sure

  Report Error

Please Enter Message
Error Reported Successfully