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
If errno contains a nonzero number, is there an error?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
Why calloc is better than malloc?
Why pointers are used in c?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
Difference between malloc() and calloc() function?
Does * p ++ increment p or what it points to?
Do array subscripts always start with zero?
Explain the use of fflush() function?
What is the use of a conditional inclusion statement in C?
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
What is a floating point in c?
Are enumerations really portable?