write a program for size of a data type without using
sizeof() operator?
Answer Posted / sunil
This has been solved in parts. I am not sure if there are
any better method merging it.
case 1. User passes a variable as the parameter.
eg: int n;
sizeof(n);
case 2. User passes a data type as the parameter.
eg: sizeof(int)
Solution
case 1: #define GetSize(x) (char*)(&x + 1) - (char*)&x
case 2:#define GetMySize(x) (char*)((x*)10 + 1) - (char*)10
Is This Answer Correct ? | 15 Yes | 6 No |
Post New Answer View All Answers
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
What is a struct c#?
What is the use of putchar function?
How do we make a global variable accessible across files? Explain the extern keyword?
What are runtime error?
What is the scope of static variable in c?
Explain a file operation in C with an example.
#include
design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.
What is the use of sizeof?
Explain what is the use of a semicolon (;) at the end of every program statement?
What is volatile, register definition in C
What is wild pointer in c?
What are the advantages of using new operator as compared to the function malloc ()?
define string ?