Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



how to find the size of the data type like int,float without using the sizeof operator?..

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

how to find the size of the data type like int,float without using the sizeof operator?..

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

how to find the size of the data type like int,float without using the sizeof operator?..

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

Post New Answer

More C Interview Questions

Find MAXIMUM of three distinct integers using a single C statement

0 Answers  


Write code for initializing one dimentional and two dimentional array in a C Program?

5 Answers   Deshaw, Edutech, GMD,


What does dm mean sexually?

0 Answers  


What is the difference between void main and main in c?

0 Answers  


What does struct node * mean?

0 Answers  


How the processor registers can be used in C ?

7 Answers   HP,


what is pointer?

13 Answers   HCL, TCS,


What is Generic pointer? What is the purpose of Generic pointer? Where it is used?

3 Answers  


What is the difference between far and near ?

0 Answers  


what is the difference between getch() and getchar()?

10 Answers   Huawei, Infosys,


do ne body have any idea about the salary for the we r going to have interview. yup .. u got it right ..i m talking abt NIC.

1 Answers  


There is a number and when the last digit is moved to its first position the resultant number will be 50% higher than the original number.Find the number?

1 Answers  


Categories