/*
* Test of code for http://stackoverflow.com/questions/15922878/pointer-to-a-nested-structure.
*/
#include <stdio.h>
#include <stdlib.h>
struct one
{
struct two
{
int r;
}*b;
}*a;
int main()
{
if(a != NULL)
{
if(a->b != NULL)
{
a->b->r = 10;
printf("the value is %d\n", a
->b
->r
); }
}
return 0;
}
LyoKICogVGVzdCBvZiBjb2RlIGZvciBodHRwOi8vc3RhY2tvdmVyZmxvdy5jb20vcXVlc3Rpb25zLzE1OTIyODc4L3BvaW50ZXItdG8tYS1uZXN0ZWQtc3RydWN0dXJlLgoqLwogCiNpbmNsdWRlIDxzdGRpby5oPgojaW5jbHVkZSA8c3RkbGliLmg+CiAKc3RydWN0IG9uZQp7CiAgICBzdHJ1Y3QgdHdvCiAgICB7CiAgICAgICAgICAgIGludCByOwogICAgfSpiOwp9KmE7CiAKaW50IG1haW4oKQp7CiAgICBhID0gbWFsbG9jKHNpemVvZiAqYSk7CiAgICBpZihhICE9IE5VTEwpCiAgICB7CiAgICAgICAgYS0+YiA9IG1hbGxvYyhzaXplb2YgKmEtPmIpOwogICAgICAgIGlmKGEtPmIgIT0gTlVMTCkKICAgICAgICB7CiAgICAgICAgICAgIGEtPmItPnIgPSAxMDsKICAgICAgICAgICAgcHJpbnRmKCJ0aGUgdmFsdWUgaXMgJWRcbiIsIGEtPmItPnIpOwogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAwOwp9Cg==