• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

C | Pointer Basics | Question 4

Consider a compiler where int takes 4 bytes, char takes 1 byte and pointer takes 4 bytes. C
#include <stdio.h>

int main()
{
    int arri[] = {1, 2 ,3};
    int *ptri = arri;

    char arrc[] = {1, 2 ,3};
    char *ptrc = arrc;

    printf(\"sizeof arri[] = %d \", sizeof(arri));
    printf(\"sizeof ptri = %d \", sizeof(ptri));

    printf(\"sizeof arrc[] = %d \", sizeof(arrc));
    printf(\"sizeof ptrc = %d \", sizeof(ptrc));

    return 0;
}

(A)

sizeof arri[] = 3 sizeof ptri = 4 sizeof arrc[] = 3 sizeof ptrc = 4

(B)

sizeof arri[] = 12 sizeof ptri = 4 sizeof arrc[] = 3 sizeof ptrc = 1

(C)

sizeof arri[] = 3 sizeof ptri = 4 sizeof arrc[] = 3 sizeof ptrc = 1

(D)

sizeof arri[] = 12 sizeof ptri = 4 sizeof arrc[] = 3 sizeof ptrc = 4

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments