Home / C Programming / Memory Allocation :: Discussion

Discussion :: Memory Allocation

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

     #include
     #include  
     
     int main() 
     {   
         int i, j;   
         int(*p)[3];    
         p = (int(*)[3])malloc(3*sizeof(*p));  
         return 0;
     } 
    

  2. A.
     for(i=0; i3; i++)
     {   
       for(j=0; j3; j++)   
             printf("%d", p[i+j]); 
     } 
    B.
    for(i=0; i3; i++)   
        printf("%d", p[i]); 
    C.
      for(i=0; i3; i++)
      {   
           for(j=0; j3; j++)   
                printf("%d", p[i][j]); 
      } 
    D.
    for(j=0; j3; j++)
         printf("%d", p[i][j]); 

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    No answer description available for this question.


Be The First To Comment