Can you cofirm my answers and see if they are correct If you

Can you cofirm my answers and see if they are correct?
If you wanted to print the data at location 3 of the integer array a, which of the following would work? Circle all that are correct. printf (\"%d\", *a+3); printf (\"%d\", a+3); printf (\"%d\", *(a+3)); printf (\"%d\", a [3]); printf (\"%d\", &a; [3]);

Solution

Answer:

d) printf(\"%d\",a[3])

the above statement is correct for print array integer.

Example:

#include<stdio.h>

int main()

{

   int i;

   int arr[3] = {10,20,30};   

arr[0] = 10;

      arr[1] = 20;

      arr[2] = 30;

for (i=0;i<5;i++)

   {

      // Accessing each variable

      printf(\"value of arr[%d] is %d \ \", i, arr[i]);

   }

}

Can you cofirm my answers and see if they are correct? If you wanted to print the data at location 3 of the integer array a, which of the following would work?

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site