Question: 6. Correct the following code errors by drawing a line through the erroneous statement and writing a corrected statement on the same line. All
6. Correct the following code errors by drawing a line through the erroneous statement and writing a corrected statement on the same line. All versions should print "x^2=169". The only change you can make to the code is the placement of "*" and "&" symbols. No other changes are permitted. Part (a) Part (b) Part (c) void } void } void square (int *p) { *p = *p* *p; } main (void) { int x, *p; P = X; X = 13; void main (void) { int x, *p; X = 13; P = &x; square (&p) printf("x^2=%d ", x); square (p) printf("x^2=%d ", x); main (void) { int x; x = 13; square ( *x ) printf("x^2=%d ", x);
Step by Step Solution
There are 3 Steps involved in it
The provided code snippets each contain a few errors in the way pointers are handled with respect to ... View full answer
Get step-by-step solutions from verified subject matter experts
