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 |
Why c is called free form language?
How was c created?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
What are the average number of comparisons required to sort 3 elements?
print the following using nested for loop. 5 4 3 2 1 1 2 3 4 3 2 1 1 2 1 2 1 1 2 3 4 3 2 1 1 2 3 4 5
Is fortran faster than c?
How can I run c program?
#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++j); printf("%d %d %d", i,j,k); } what will the values of i , j and k? }
14 Answers CDAC, GATE, NDS, TCS,
WAP that prints the number from 1 to 100. but for multiplies of three print "XXX" instead of the number and for the multiplies of five print "YYY" . for number which are multiplies of both three and five print "ZZZ"
create an SINGLE LINKED LISTS and reverse the data in the lists completely
Is a house a mass structure?
Write a C program to find the smallest of three integers, without using any of the comparision operators.