3 votes 3 votes what wil be sizeof(void) and sizeof(void *) Programming in C programming-in-c + – Ravi prakash pandey asked Nov 12, 2017 • edited Nov 12, 2017 by Ravi prakash pandey Ravi prakash pandey 665 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes void is datatype which has size of 1 Byte like char, but void* is a pointer it is called as raw pointer. normally in c size of integer pointer is 2 byte but it depends upon the machine architecture. (i.e on 64 bit system it will be 8 Byte) harrygate answered Nov 12, 2017 • edited Nov 12, 2017 by harrygate harrygate comment Share Follow See all 9 Comments See all 9 9 Comments reply Arjun commented Nov 12, 2017 reply Follow Share normally in c size of pointer is 2 byte Which is this normal C? 0 votes 0 votes harrygate commented Nov 12, 2017 reply Follow Share I mean in gate we normally consider size of pointer as 2 Byte . 0 votes 0 votes Arjun commented Nov 12, 2017 reply Follow Share Who told this? Can you show at least 1 GATE question where this has happened? 0 votes 0 votes harrygate commented Nov 12, 2017 reply Follow Share http://www.c4learn.com/c-programming/c-size-of-pointer-variable/ 0 votes 0 votes Arjun commented Nov 12, 2017 reply Follow Share I asked for GATE question -- not some crappy website. For GATE you must follow standard sources. 3 votes 3 votes joshi_nitish commented Nov 12, 2017 reply Follow Share @harrygate size of pointers = size of largest primitive data type. in C, the largest data type is float(8 bytes), therefore, sizeof pointer = 8 bytes. 0 votes 0 votes Arjun commented Nov 12, 2017 reply Follow Share @Joshi That is not true. In C long double is there which is of size 10 bytes. But sizeof pointer is not related to size of any other type. On 64-bit system, it is of size 8 bytes which is the norm today. But a 32 bit compiler can also run on a 64-bit system in which size of a pointer will be 4 bytes. Some 3rd grade colleges still have systems which runs only 16-bit compilers (who gave them Engineering college status? :O) and the result is such websites which you can see in some comment above. 2 votes 2 votes joshi_nitish commented Nov 12, 2017 reply Follow Share ok sir, thanks! 0 votes 0 votes Niraj Singh 2 commented Nov 12, 2017 reply Follow Share i think it is machine dependent ! 0 votes 0 votes Please log in or register to add a comment.