write a program for size of a data type without using
sizeof() operator?

Answer Posted / fanish

#include <stdio.h>
int main(){
printf("%d\n",((int*)0 + 1));
}

We can replace int with any other type
(Built-in/user-defined ) to get the size.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are pointers? What are different types of pointers?

636


What is "Hungarian Notation"?

647


What is string concatenation in c?

579


What is exit() function?

570


What is the use of structure padding in c?

574






c program for searching a student details among 10 student details

1668


What is difference between class and structure?

582


Why #include is used in c language?

607


What is meant by inheritance?

644


What is the right type to use for boolean values in c? Is there a standard type?

576


What are the advantages and disadvantages of pointers?

590


What is the purpose of macro in C language?

675


I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.

1749


What is the difference between new and malloc functions?

587


What is a example of a variable?

563