how to find the size of the data type like int,float
without using the sizeof operator?
Answers were Sorted based on User's Feedback
Answer / abhishek pathak mnnit
#include <stdio.h>
#define sizeof(x) ((void *)(&x + 1) - (void *)(&x))
void main()
{
int a;
printf("int size=%d",sizeof(a));
}
Is This Answer Correct ? | 3 Yes | 8 No |
Answer / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
int ptr,a[2];
char ptr1,b[2];
float ptr2,c[2];
ptr=(a+1)-a;
ptr1=(b+1)-b;
ptr2=(c+1)-c;
printf("int : %d\n",ptr);
printf("char : %d\n",ptr1);
printf('float : %d\n",ptr2);
getch();
}
than ku
Is This Answer Correct ? | 0 Yes | 8 No |
Answer / ravi.jnv
Its possible by pointers.
-----------------
int one,two;
int *ptrOfOne,*ptrOfTwo;
int size;
ptrOfOne = &one;
ptrOfTwo = &two;
size = ptrOfOne - ptrOfTwo ; /* u can get minus value also
depending upon stack how it pushes variables */
Is This Answer Correct ? | 6 Yes | 28 No |
Whether there can be main inside another main?If so how does it work?
inline function is there in c language?
Explain what are header files and explain what are its uses in c programming?
Explain the process of converting a Tree into a Binary Tree.
write a program to generate 1st n fibonacci prime number
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
Where are the auto variables stored?
Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors
sqrt(x+sqrt(x+sqrt(x+sqrt(x))))=2; Find the value of x?
Explain how do you declare an array that will hold more than 64kb of data?
a=0; b=(a=0)?2:3; a) What will be the value of b? why b) If in 1st stmt a=0 is replaced by -1, b=? c) If in second stmt a=0 is replaced by -1, b=?
How can I find out the size of a file, prior to reading it in?