0 votes 0 votes Say I declare an array like int abc ; int arr[abc] ; printf("%d",sizeof(arr)); Now this abc holds some garbage value so then how come the size of the array is negative value , does it means that the array arr is not allocated any memory space ? Programming in C programming-in-c + – radha gogia asked Sep 13, 2015 radha gogia 1.0k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes I executed same on unix machine and output is :1504931616 . I am using 64bit unix O.S , gcc compile to run the program . U are getting negative it could be due randomness of the garbage values. That's why it's called garbage as there is no such pattern which is followed in displaying values. And moreover negative does not mean that address space is not allocated , negative may mean that the way variable are stored .They could be stored in unsinged form. zatin answered Sep 13, 2015 zatin comment Share Follow See 1 comment See all 1 1 comment reply ankyAS commented Nov 5, 2016 reply Follow Share It think it should result in compilation error as GCC does not provide dynamic array allocation 0 votes 0 votes Please log in or register to add a comment.