+ 6

What is size of void , null , undefined ?

24th Mar 2018, 9:01 AM
Amar Dahake
6 odpowiedzi
+ 2
If this is c a void pointer can point to any type, but we don't know the type and therefore the size, this has a size of 1 by default. Any function that uses a void pointer should also have the size of the type as a variable, so the function can use the true size. You cannot​ look up the qsort prototype as an example. This can be used in c++, but templates provide a safer way to write generic functions.
24th Mar 2018, 12:11 PM
Jared Bird
Jared Bird - avatar
+ 6
Void indicates that function hasn’t return.
24th Mar 2018, 10:02 AM
Chalza
Chalza - avatar
+ 5
Size ? In wich language ?
24th Mar 2018, 9:10 AM
Chalza
Chalza - avatar
+ 5
Void is a type of a function, it hasn’t value ( no size ). Null and undifined , same.
24th Mar 2018, 9:39 AM
Chalza
Chalza - avatar
+ 5
then why sizeof(void) gives 1 byte
24th Mar 2018, 9:40 AM
Amar Dahake
+ 3
any
24th Mar 2018, 9:11 AM
Amar Dahake