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 much is size of struct having 1 char & 1 integer?

Answers were Sorted based on User's Feedback



How much is size of struct having 1 char & 1 integer?..

Answer / rahul

it is 8 bytes. look for answer on google.

Is This Answer Correct ?    17 Yes 7 No

How much is size of struct having 1 char & 1 integer?..

Answer / vadivelt

The size of the stucture depends on the following factors.

1.Depends on the size of the datatype, allocated by compiler
2.Depends on the allignment of the variables in the
structure.

If variables of different datatypes are misalligned, then
badding bytes will be added by the compiler to falitate to
speed up the memory access by the processor.So that the size
of the structure will increase.

Is This Answer Correct ?    11 Yes 4 No

How much is size of struct having 1 char & 1 integer?..

Answer / raja

you will have to study through structure padding concepts.
It depends on the compiler.
struct
{
char a;
int b;
}
The above struct size will be 8 in standard compilers (Turbo
C is a non-standard compiler). bcoz between a and b there
will be 3 pad bytes placed..

Refer this link you will know everything about structure
padding..All d best :)
http://www.allinterview.com/showanswers/62991.html

Is This Answer Correct ?    5 Yes 1 No

How much is size of struct having 1 char & 1 integer?..

Answer / poorn singh

the object for the struct will use 3 bytes (1 byte for char and 2 byte for integer) in a sequential manner.

Is This Answer Correct ?    9 Yes 6 No

How much is size of struct having 1 char & 1 integer?..

Answer / amruta

i think its 3 bytes
i am not getting how is it 8 bytes

Is This Answer Correct ?    7 Yes 6 No

How much is size of struct having 1 char & 1 integer?..

Answer / shahbaz

as the size of char in C++ and C is one byte and the size of
int in C++,c is 2 byte so when we illl call that struct then
the memory will assigned the contents of these char and
int's variables
But
Char in C# and java is of 16 bit and in is of 32 bits and
double of 64 bits so the size of struct is depends upon
these languages.

Is This Answer Correct ?    2 Yes 2 No

How much is size of struct having 1 char & 1 integer?..

Answer / uttam kumhar

1 char always hold 1 byte in c in any 32-bit or 64-bit system
but in case of int it vary on the system.if there is 32-bit system the int hold 4-byte memory ...and if 64-bit system int hold 2-byte memory....

Is This Answer Correct ?    0 Yes 0 No

How much is size of struct having 1 char & 1 integer?..

Answer / chinmay

#include<stdio.h>
#include<conio.h>

void main()
{
struct idk
{
char ch;
int i;
}abc;

printf("size of structure is: %d",sizeof(abc));
getch();

}

O/P is 3

Is This Answer Correct ?    0 Yes 0 No

How much is size of struct having 1 char & 1 integer?..

Answer / santosh jain

zero , struct will not have any size in memory untill
object is created.

Is This Answer Correct ?    7 Yes 12 No

How much is size of struct having 1 char & 1 integer?..

Answer / saranya

The character datatype takes "1 Byte" for their memory. the
integer takes "2 Bytes" for their memory

Is This Answer Correct ?    6 Yes 12 No

Post New Answer

More C++ General Interview Questions

What is a protocol class?

1 Answers  


Which coding certification is best?

0 Answers  


What are the main differences between C and C++?

1 Answers  


let a,b,c be three integer numbers.write a c++ program with a function void rotate 1()such that a->b->c and c->a.

1 Answers  


Can a constructor return a value?

1 Answers  


simple c++ program for "abcde123ba" convert "ab321edcba" with out using string

5 Answers  


Write about the various sections of the executable image?

0 Answers  


What does it mean to declare a member function as virtual?

0 Answers  


Describe the syntax of single inheritance in C++?

0 Answers   Fidelity,


if there is binary tree which one is the easiest way to delete all child node?

1 Answers   Persistent,


What is the use of bit fields in structure declaration?

0 Answers  


Out of fgets() and gets() which function is safe to use and why?

0 Answers  


Categories