>> Make an array of structures and find the difference in >> addresses of 2 >> consecutive array elements. ... > this wudnt work coz according to array arithmetic the > difference > between the addresses of adjacent elemenst wud give 1.
He said "the difference in addresses" not "the difference between pointers" or "the difference between array indices". Get two pointers-to-struct, then cast each of them to a pointer-to-char. A char is guaranteed to be a single byte. So the difference between the pointers-to-char will be in bytes. > can u give plz me code to implement this.. Sorry, you'll have to do that yourself, but here are some hints. You can allocate an area of memory using malloc but without using sizeof, which means guessing the size of the structure and then adding a safety margin. And you can fill the memory using memset. To examine the memory you'll have to write a loop to scan through it one byte at a time. > cud u plz elaborate on padding concept? http://en.wikipedia.org/wiki/Data_structure_alignment Google and Wikipedia are your friends. :-) David
