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

Answer Posted / g

This code will work in TC with 2 warnings but can get result

void main()
{
char *Ptr1,*Ptr2;
float fl;
ptr1 = &fl;
ptr2 = (&fl+1);

printf("%u",ptr2-ptr1);
}

This is a way to get the size of data type...waiting for
any other way...

Is This Answer Correct ?    44 Yes 26 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What's the difference between constant char *p and char * constant p?

659


What are compound statements?

630


Why do we use null pointer?

608


How can I remove the trailing spaces from a string?

617


Explain what is the purpose of "extern" keyword in a function declaration?

624






Whats s or c mean?

594


Explain how can you determine the size of an allocated portion of memory?

625


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

633


What is the g value paradox?

646


What is typedef?

680


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

776


How many identifiers are there in c?

584


What is a program flowchart and explain how does it help in writing a program?

679


What is "Hungarian Notation"?

638


Can you write the function prototype, definition and mention the other requirements.

664