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

What is difference between constant pointer and constant variable?

631


How to set file pointer to beginning c?

671


How can I call a function with an argument list built up at run time?

642


will u please send me the placement papers to my mail???????????????????

1367


What is the explanation for modular programming?

688






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

15053


What is the size of array float a(10)?

658


What is the time and space complexities of merge sort and when is it preferred over quick sort?

677


using only #include and #include Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.

1315


What is static and volatile in c?

782


What are directives in c?

549


What are the different types of constants?

642


Is int a keyword in c?

558


Why doesnt that code work?

603


Can you think of a logic behind the game minesweeper.

2011