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

What does nil mean in c?

665


How can I split up a string into whitespace-separated fields?

560


How will you write a code for accessing the length of an array without assigning it to another variable?

607


What is function and its example?

614


Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.

647






State two uses of pointers in C?

630


can any one tel me wt is the question pattern for NIC exam

1550


what are the advantages of a macro over a function?

633


p*=(++q)++*--p when p=q=1 while(q<=6)

1259


Are enumerations really portable?

585


What is meant by realloc()?

662


What are loops in c?

539


What is the code in while loop that returns the output of given code?

1281


Explain what does it mean when a pointer is used in an if statement?

605


Why string is used in c?

569