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

Answers were Sorted based on User's Feedback



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

Answer / mazhar shaikh

datatype a,*p,*q;
p=&a;
q=p+1;
cout<<abs(int(p)-int(q))<<endl;

Is This Answer Correct ?    5 Yes 7 No

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

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int integer[2],p;
float floating[2],q;
char character[2],r;
double doubling[2],s;
clrscr();
p=(integer+1)-integer;
q=(floating+1)-floating;
r=(character+1)-character;
s=(doubling+1)-doubling;
printf("the sizeof int is :%d",p);
printf("\nthe size of float is :%d",q);
printf("\nthe size of character is :%d",r);
printf("\nthe size of double is :%d",s);
getch();
}


thank u

Is This Answer Correct ?    5 Yes 11 No

Post New Answer

More C Interview Questions

Where is volatile variable stored?

0 Answers  


what is data structure?

5 Answers   CBSE,


Is there any data type in c with variable size?

0 Answers  


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

1 Answers   CMS,


what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }

3 Answers   Honeywell,


Do character constants represent numerical values?

0 Answers  


What is the output of the following program #include<stdio.h> main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); }

8 Answers   ADITI, Adobe,


What are the disadvantages of a shell structure?

0 Answers  


without using arithmatic operator solve which number is greater??????????

1 Answers   Accenture,


Once I have used freopen, how can I get the original stdout (or stdin) back?

0 Answers  


EXPLAIN #INCLUDE<STDIO.H> EXPLAIN #INCLUDE<CONIO.H>

4 Answers  


Define Spanning-Tree Protocol (STP)

0 Answers  


Categories