Home » Technical Questions » Programming

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

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

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion