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

Answer Posted / subham singh

1 #include<iostream>
2 using namespace std;
3 main()
4 {
5 int i;
6 int* p = &i;
7 int* q= p;
8 p++;
9 cout<<(char*)p-(char*)q<<endl;
10 }
11
~

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the advantage of an array over individual variables?

745


What are the 4 data types?

603


Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

15053


What is the use of gets and puts?

605


Define Array of pointers.

636






What is New modifiers?

672


explain what is fifo?

635


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

914


Can stdout be forced to print somewhere other than the screen?

627


How can I prevent another program from modifying part of a file that I am modifying?

615


State the difference between realloc and free.

636


How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

650


What is sizeof return in c?

618


Which header file is used for clrscr?

583


Can I initialize unions?

595