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

Answer Posted / mukesh kumar singh

#include <iostream>
using namespace std;
struct node {
int x;
int y;
char *s;
};
int main()
{


node x,*p;/* here u can change the type */

p=&x;
cout<<"\n\nSize of node Is : "<<(char*)(p+1)-(char*)p;
return 0;
}

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the advantage of a random access file?

903


hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..

1720


i have a written test for microland please give me test pattern

2481


What is the use of a conditional inclusion statement in C?

841


Why do we use int main?

844


how to create duplicate link list using C???

2277


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

879


What is a constant?

820


How to set file pointer to beginning c?

914


What is a c token and types of c tokens?

821


Which built-in library function can be used to match a patter from the string?

1001


What are structure types in C?

868


Explain the use of #pragma exit?

915


Explain what is the use of a semicolon (;) at the end of every program statement?

971


write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a

1675