for compiler giving 8 bit for pointers, shouldn't int also be of 8 bits??
On Thu, Jul 28, 2011 at 12:26 PM, Jnana Sagar wrote:
> @aditya..the answer may vary, because c is machine dependent
> language..in few machines int is of 2 bytes and char is of 1 byte..u
> can't say..it varies with diff mac
@aditya..the answer may vary, because c is machine dependent
language..in few machines int is of 2 bytes and char is of 1 byte..u
can't say..it varies with diff machines
On 7/26/11, aditya kumar wrote:
> char *s[5] is a array of pointers of type char . but the thing is size of
> pointers is 4byte
Okay.
I was a bit wrongactually the thing is that
The exact number of bytes allocated for various C data types depends on *both
the machine and the compiler.**
*so it may be the that the compiler u are using is 32 bit..
one thing that u can try out is that on ubuntu install 64 bit code
@ sunny ; i am working on 64 bit windows 7 with dev and also in gcc + ubuntu
64 bit ... am using i3 processor that is 64 bit... what should do to get
size 8 byte ?
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send
On Wed, Jul 27, 2011 at 2:18 PM, hary rathor wrote:
> @sunny : what you means by machine dependent means 64 bit: you means by
> compiler / operating system /computer architecture ?
> because i never get size of pointer 8 byte. if your statement true then
> tell me which compiler / operating syst
computer architecture !!!
64 bit machine has word size of 8 bytes so pointers are of 8 bytes
you never got size as 8 byte because u might be working on a 32 bit machine
!!
On Wed, Jul 27, 2011 at 2:18 PM, hary rathor wrote:
> @sunny : what you means by machine dependent means 64 bit: you means
@sunny : what you means by machine dependent means 64 bit: you means by
compiler / operating system /computer architecture ?
because i never get size of pointer 8 byte. if your statement true then tell
me which compiler / operating system /computer architecture i should have
get this output 8.
-
yes
on a 64 bit machine ans will be 4+5*8+8 = 52 bytes
pointers take 8 byte on 64 bit machine
On Tue, Jul 26, 2011 at 8:00 PM, vaibhav shukla wrote:
> will there be any difference in size on 32 machine and on 64 bit machine ?
> how and what ?
>
> On Tue, Jul 26, 2011 at 7:58 PM, kavitha nk wrote
will there be any difference in size on 32 machine and on 64 bit machine ?
how and what ?
On Tue, Jul 26, 2011 at 7:58 PM, kavitha nk wrote:
>
>
> sry frendzma above posts were wrongans is 28 if ptr takes 4
> bytes...
> //BE COOL// kavi
>
> --
> You received this message because you a
sry frendzma above posts were wrongans is 28 if ptr takes 4 bytes...
//BE COOL// kavi
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, s
> On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam
> wrote:
>
>> @everyone:
>> I have this mind strangling doubt..!!!
>>
>> Why is "char *s[5]" of 20 bytes...?
>>
5 x sizeof (*s). do you see ?
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group
It is not 28 ?
4 sizeof(int) + 20 + 4 (ptr). And no padding, cos' all is mutiple of 4.
>> > On Jul 26, 7:40 am, Puneet Gautam wrote:
>> >> #include
>> >> #include
>> >> struct node{
>> >> int a;
>> >> char *b[5];
>> >> struct node *link;
>> >> };
>> >> main()
>> >> {
sry memory...
On 7/26/11, Akshata Sharma wrote:
> @kavitha, what is m/y?
>
> On Tue, Jul 26, 2011 at 7:27 PM, kavitha nk wrote:
>
>> the link ll not occupy any m/y here...so its output ll be 14(int -4
>> bytes,ptr-2 bytes);;if i'm wrong jst crct it...
>>
>>
>> On 7/26/11, Prem Krishna Chettri
@kavitha, what is m/y?
On Tue, Jul 26, 2011 at 7:27 PM, kavitha nk wrote:
> the link ll not occupy any m/y here...so its output ll be 14(int -4
> bytes,ptr-2 bytes);;if i'm wrong jst crct it...
>
>
> On 7/26/11, Prem Krishna Chettri wrote:
> > Its Cos that is pointer and all pointers is 4 bytes
the link ll not occupy any m/y here...so its output ll be 14(int -4
bytes,ptr-2 bytes);;if i'm wrong jst crct it...
On 7/26/11, Prem Krishna Chettri wrote:
> Its Cos that is pointer and all pointers is 4 bytes address..
>
> On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam
> wrote:
>
>> @everyone:
padding..
4 byes int + 3 padding bytes + 5 char bytes + 4 bytes pointer =16
On Tue, Jul 26, 2011 at 7:22 PM, Puneet Gautam wrote:
> for the above mentioned code, in previous post,: shudnt the output be
> 4+5+4=13?
>
> On 7/26/11, Prem Krishna Chettri wrote:
> > Its Cos that is pointer and all po
for the above mentioned code, in previous post,: shudnt the output be 4+5+4=13?
On 7/26/11, Prem Krishna Chettri wrote:
> Its Cos that is pointer and all pointers is 4 bytes address..
>
> On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam
> wrote:
>
>> @everyone:
>> I have this mind strangling doubt.
Its Cos that is pointer and all pointers is 4 bytes address..
On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam wrote:
> @everyone:
> I have this mind strangling doubt..!!!
>
> Why is "char *s[5]" of 20 bytes...?
>
> yes the output is 28...
>
> On 7/26/11, Don wrote:
> > A reasonable guess would be
ok...!
#include
#include
struct node{
int a;
char b[5];
struct node *link;
};
main()
{
int a;
a=sizeof(struct node);
printf("%d",a);
getchar();
return 0;
}
why is its output : 16?
Sudnt it be 4(int a) +5(char b[5] string) +9(link)= 1
char *s[5] is a array of pointers of type char . but the thing is size of
pointers is 4byte irrespective of its type . coz address is always an
unsigned int which is of 4byte.
On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam wrote:
> @everyone:
> I have this mind strangling doubt..!!!
>
> Why is "ch
char *s[5] is an array of 5 char pointers. A pointer is an int, of size 4
bytes. So, 5*4 = 20 bytes
On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam wrote:
> @everyone:
> I have this mind strangling doubt..!!!
>
> Why is "char *s[5]" of 20 bytes...?
>
> yes the output is 28...
>
> On 7/26/11, Don
@everyone:
I have this mind strangling doubt..!!!
Why is "char *s[5]" of 20 bytes...?
yes the output is 28...
On 7/26/11, Don wrote:
> A reasonable guess would be 28 bytes. But the size of a structure is
> implementation dependent, and therefore, some other result could be
> correct as well.
>
A reasonable guess would be 28 bytes. But the size of a structure is
implementation dependent, and therefore, some other result could be
correct as well.
Don
On Jul 26, 7:40 am, Puneet Gautam wrote:
> #include
> #include
> struct node{
> int a;
> char *b[5];
> struct node *li
23 matches
Mail list logo