Can U write a C-program to print the size of a data type
without using the sizeof() operator? Explain how it works
inside ?

Answer Posted / rajesh

#include<stdio.h>
int main()
{
int p;

printf("%d\n",(char*)(&p+1)-(char*)(&p));
return 0;
}

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1

3822


Explain the ternary tree?

693


Write the Program to reverse a string using pointers.

706


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

716


What are volatile variables in c?

610






What is the process to generate random numbers in c programming language?

722


What are the similarities between c and c++?

690


What are pointers really good for, anyway?

712


What do you mean by c?

683


Lists the benefits of c programming language?

693


The statement, int(*x[]) () what does in indicate?

767


exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above

778


What are bitwise shift operators in c programming?

729


Write a factorial program using C.

733


What does d mean?

673