GeeksforGeeks » Interview Questions

Interview Question for Software Engineer/Developer (Fresher) about CPuzzles

(2 posts)

Tags:

  1. gagan
    guest
    Posted 1 year ago #

    #include<stdio.h>
    int main(void)
    {
      int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };
      int *q = ***a;
      printf("%d", *q);
      getchar();
      return 0;
    }
    

    output?

  2. Ankul
    guest
    Posted 1 year ago #

    This code would give segmentation fault. The correct syntax should be :

    #include<stdio.h>
    int main(void)
    {
    int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };
    int *q = a;
    printf("%d", *q);
    getchar();
    return 0;
    }

    which will return 10.


Reply

You must log in to post.

RSS feed for this topic