Printf will print one value per item in the format string.
If you don't supply that many, it will look at the undefined memory where 
that value should have been, so you will get gibberish.
Don

On Friday, December 6, 2013 9:17:36 AM UTC-5, segfault wrote:
>
> Hi All,
>
> I'm not able to get output of following c program : 
>
> #include<stdio.h>
>  main()
>  {
>      int a[] ={ 1,2,3,4,5,6,7};
>      char c[] = {'a','x','h','o','k'};
>  //    printf("%u   %u\n", &a[3], &a[0]);                      line 6
>      printf("%d %d %d %d \n", (&a[3]-&a[0]));
>  }
>
> If line 6 is commented, output : 
>
> 3 1562814827 1869117537 0     
>
> Confusion : why is there 4 output?   "(&a[3]-&a[0])" should give only one.
>
> if line 6 is not commented, output : 
>  
> 1554221244   1554221232
> 3 1554221232 1309214001 64
>
>
>
> Can anybody please explain why/how these outputs are coming?
>
> Thanks,
> Pawan. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.

Reply via email to