adplus-dvertising
frame-decoration

Question

Point out the error in the program.
#include<stdio.h>
#define MAX 128

int main()
{
    char mybuf[] = "CompSci";
    char yourbuf[] = "Bits";
    char const *ptr = mybuf;
    *ptr = 'a';
    ptr = yourbuf;
    return 0;
}

a.

Error: cannot convert ptr const value

b.

Error: unknown pointer conversion

c.

No error

d.

None of above

Posted under C Programming

Answer: (a).Error: cannot convert ptr const value

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Point out the error in the program.