A Place for Latest Exam wise Questions, Videos, Previous Year Papers, Study Stuff for MCA Examinations - NIMCET
Previous Year Question (PYQs)
3
Consider the following C language declarations & statements.
Which statement is erroneous?
float f1 = 9.9;
float f2 = 66;
const float *ptrF1;
float * const ptrF2 = &f2;
ptrF1 = &f1;
ptrF2++;
ptrF1++;
Solution
- `const float *ptrF1;` → pointer to constant float, can move pointer, not modify value.
- `float * const ptrF2 = &f2;` → constant pointer to float, cannot change address, but can modify value.
- Statement `ptrF2++` tries to move a **constant pointer**, which is **not allowed**.
Hence, `ptrF2++` is **erroneous**.
Online Test Series, Information About Examination, Syllabus, Notification and More.