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)); } } student submitted image, transcription available below

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!