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 |
what is the difference between structural,object based,object orientd programming languages?
What is the diffences between Windows XP and Windows Visa
Why is this loop always executing once?
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
difference between Low, Middle, High Level languages in c ?
Explain how does free() know explain how much memory to release?
Explain data types & how many data types supported by c?
how to multiply two number taking input as a string (considering sum and carry )
What is the right type to use for boolean values in c? Is there a standard type?
Write a program that can show the multiplication table.
What are the types of unary operators?
What is double pointer?