Question: C prgram, Cprogram Q1. (5 marks) Find the error in the following program: #include int main(void) { int x; // define x int y; //
C prgram, Cprogram Q1. (5 marks) Find the error in the following program: #include int main(void) { int x; // define x int y; // define y int * const ptr = &x; *ptr = 7; ptr = &y; } Q2. (5 marks) What will be printed? Explain the output? #include int main( void ){ int a[] = { 6, 7, 0, 1 }, I; int *aPtr = a; for ( I = 0; I < 4; i++ ) { printf( %d , a[i] ); printf( %d , aPtr[i]); printf( %d , *(aPtr+i)); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
