1.

Point out the correct statement will let you access the elements of the array using 'p' in the following program?

#include<stdio.h>
#include<stdlib.h> int main()
{ int i, j; int(*p)[3]; p = (int(*)[3])malloc(3*sizeof(*p)); return 0;
}

A. <pre><code class="cpp">for(i=0; i&lt;3; i++) { for(j=0; j&lt;3; j++) printf("%d", p[i+j]); } </code></pre>
B. <pre><code class="cpp">for(i=0; i&lt;3; i++) printf("%d", p[i]); </code></pre>
C. <pre><code class="cpp">for(i=0; i&lt;3; i++) { for(j=0; j&lt;3; j++) printf("%d", p[i][j]); } </code></pre>
D. <pre><code class="cpp">for(j=0; j&lt;3; j++) printf("%d", p[i][j]); </code></pre>
Answer» D. <pre><code class="cpp">for(j=0; j&lt;3; j++) printf("%d", p[i][j]); </code></pre>


Discussion

No Comment Found