GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Aalayance Inc  >  Interview Procedure
Go To First  |  Previous Question  |  Next Question 
 Interview Procedure  |  Question 7 of 8    Print  
how to find size of an variable without using sizeof operator ?

  
Total Answers and Comments: 2 Last Update: November 24, 2006     Asked by: prashant tambe 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 10, 2006 06:55:29   
Nimmi        

RE: how to find size of an variable without using size...

Declare 2 pointer variable of the same type and assign the address of the variable to them and then increment one of them.

Find the difference between the above 2 pointers using a type cast. This will be the size of the variable.

Eg:

double i;

double * p &i;

double * q p;

p++;

cout<<(int)p-(int)q<<endl;


 
Is this answer useful? Yes | No
November 23, 2006 23:38:56   
T.Raghavendra        

RE: how to find size of an variable without using size...
program to find the size of variable without using sizeof operator #include main() { int i 01; int count 0; int size; while(i) { i i << 1; count++; } size count/8; printf( The size of int variable is dn size);
 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : program to find the size of variable without using sizeof operator #include main() { int i = 01; int count = 0; int size; while(i) { i = i ...
Read Answers (2) | Asked by : prashant tambe


 Sponsored Links

 
Related Articles

C++ Dereference Operator

C Dereference Operator In this C tutorial you will learn how to access the value of variables pointed by the pointer variables using pointer concept discussed in detail mosgoogle center It is possible to access the value of variables pointed by the pointer variables using pointer This is performed
 

C++ Operator Overloading Part II

C Operator Overloading Part II Operator overloading is a very important aspect of object oriented programming Binary operators can be overloaded in a similar manner as unary operators In this C tutorial you will learn about Binary Operating Overloading explained along with syntax and example mosgoog
 

What happens when a variable is not initialized in main function?

When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below main() { int x; printf(&ldquo;%d&rdquo;,x); z= sample() } sample() { printf(&ldquo;Testing program&rdquo;); } Output is &nbsp;&nbsp;&n
 

What happens when a variable is not declared in function definition?

Generally in C program the function definition and calling takes the form as given below: main() { int x,y,z; z=sample(x,y); printf(&ldquo;%d&rdquo;,z); } sample(x1,y1) int x1,y1; { int z1; z1= x1 - y1; return(z1); } Here what happens is the values x, y gets passed to x1,y1
 

sizeof Operator

What is sizeof operator? sizeof will return the number of bytes reserved for a variable or data type. The sizeof operator is a compile-time operator that returns an integer value. In other words since sizeof is a compile time operator, when used in a expression, it does not get compiled into executa
 

Modulus Operator

What is the functionality and restrictions of Modulus Operator? When a division is performed, the remainder of the operation is given by modulus operator. The modulus operator is denoted in c by symbol %. For instance we have two integer values x and y, the operation x % y called as x modulus y give
 

Operator, Operand and Expression in C

Operator, Operand, and Expression in are symbols which take one or more operands or expressions and perform arithmetic or logical computations. Types of operators available in C are as follows: Arithmetic Assignment Logical/relational Bitwise These have operators under each
 

Prefix and Postfix Operator

How does the prefix and postfix operator on expression? The operators present in prefix and postfix are prefix increment operator denoted by ++ prefix decrement operator denoted by -- postfix increment operator postfix decrement operator The difference between the two is that i
 

The Interview Snafu

How to turn someone else&rsquo;s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won&rsquo;t get over the line without a polished, prof
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape