dimanche 26 mars 2017

Address of address of a array

The following code on execution gives output as '6'.

#include<stdio.h>

int main()
{
        int a[]={7,5,3,4,1,6};
        int *ptr=(int*)(&a+1);
        printf("%d",*(ptr-1));
        return (0);
}

I cannot understand what does the line part "(int*)(&a+1)" mean.

Aucun commentaire:

Enregistrer un commentaire