[algogeeks] Re: size of array

2013-01-30 Thread Don
There is not a sure way to do that in C or C++ without putting an additional requirement on the caller. Don On Jan 28, 5:14 am, Anil Sharma anilsharmau...@gmail.com wrote: How to calculate the size/lenght of an int array which is passed as an ONLY argument to a function??? -- You

Re: [algogeeks] Re: size of

2011-09-07 Thread sukran dhawan
null is a macro defined in stdio.h which is equal to 0 . so sizeof(0) is 4 :) On Wed, Sep 7, 2011 at 2:44 AM, UTKARSH SRIVASTAV usrivastav...@gmail.comwrote: and why sizeof(NULL) is giving 4 any ans? -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT ALLAHABAD* -- *UTKARSH

[algogeeks] Re: size of

2011-09-06 Thread UTKARSH SRIVASTAV
and why sizeof(NULL) is giving 4 any ans? -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT ALLAHABAD* -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT ALLAHABAD* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: Re : [algogeeks] Re: size of self referential structure

2011-07-28 Thread sunny agrawal
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

Re: [algogeeks] Re: size of self referential structure

2011-07-28 Thread Jnana Sagar
@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 aditya.kumar130...@gmail.com wrote: char *s[5] is a array of pointers of type char . but the thing is

Re: [algogeeks] Re: size of self referential structure

2011-07-28 Thread Tushar Bindal
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 supremeofki...@gmail.comwrote: @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

Re: Re : [algogeeks] Re: size of self referential structure

2011-07-27 Thread hary rathor
@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.

Re: Re : [algogeeks] Re: size of self referential structure

2011-07-27 Thread sunny agrawal
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 harry.rat...@gmail.com wrote: @sunny : what you means by machine dependent

Re: Re : [algogeeks] Re: size of self referential structure

2011-07-27 Thread Anand Saha
On Wed, Jul 27, 2011 at 2:18 PM, hary rathor harry.rat...@gmail.com 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

Re: Re : [algogeeks] Re: size of self referential structure

2011-07-27 Thread hary rathor
@ 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

[algogeeks] Re: size of self referential structure

2011-07-26 Thread Don
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 puneet.nsi...@gmail.com wrote: #includestdio.h #includestddef.h struct node{        int a;        

Re: [algogeeks] Re: size of self referential structure

2011-07-26 Thread Puneet Gautam
@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 dondod...@gmail.com wrote: A reasonable guess would be 28 bytes. But the size of a structure is implementation dependent, and therefore, some other result could be

Re: [algogeeks] Re: size of self referential structure

2011-07-26 Thread Akshata Sharma
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 puneet.nsi...@gmail.comwrote: @everyone: I have this mind strangling doubt..!!! Why is char *s[5] of 20 bytes...? yes the output is 28... On

Re: [algogeeks] Re: size of self referential structure

2011-07-26 Thread aditya kumar
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 puneet.nsi...@gmail.comwrote: @everyone: I have this mind strangling

Re: [algogeeks] Re: size of self referential structure

2011-07-26 Thread Puneet Gautam
ok...! #includestdio.h #includestddef.h 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]

Re: [algogeeks] Re: size of self referential structure

2011-07-26 Thread Prem Krishna Chettri
Its Cos that is pointer and all pointers is 4 bytes address.. On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: @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 dondod...@gmail.com

Re: [algogeeks] Re: size of self referential structure

2011-07-26 Thread Puneet Gautam
for the above mentioned code, in previous post,: shudnt the output be 4+5+4=13? On 7/26/11, Prem Krishna Chettri hprem...@gmail.com wrote: Its Cos that is pointer and all pointers is 4 bytes address.. On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: @everyone: I

Re: [algogeeks] Re: size of self referential structure

2011-07-26 Thread Akshata Sharma
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 puneet.nsi...@gmail.comwrote: for the above mentioned code, in previous post,: shudnt the output be 4+5+4=13? On 7/26/11, Prem Krishna Chettri hprem...@gmail.com wrote:

Re: [algogeeks] Re: size of self referential structure

2011-07-26 Thread kavitha nk
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 hprem...@gmail.com wrote: Its Cos that is pointer and all pointers is 4 bytes address.. On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam

Re: [algogeeks] Re: size of self referential structure

2011-07-26 Thread Akshata Sharma
@kavitha, what is m/y? On Tue, Jul 26, 2011 at 7:27 PM, kavitha nk kavithan...@gmail.com 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 hprem...@gmail.com wrote: Its Cos that is

Re: [algogeeks] Re: size of self referential structure

2011-07-26 Thread kavitha nk
sry memory... On 7/26/11, Akshata Sharma akshatasharm...@gmail.com wrote: @kavitha, what is m/y? On Tue, Jul 26, 2011 at 7:27 PM, kavitha nk kavithan...@gmail.com 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...

Re : [algogeeks] Re: size of self referential structure

2011-07-26 Thread Charlotte Swazki
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 puneet.nsi...@gmail.com wrote: #includestdio.h #includestddef.h struct node{         int a;         char *b[5];         struct node *link;         }; main() {

Re : [algogeeks] Re: size of self referential structure

2011-07-26 Thread Charlotte Swazki
On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: @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

Re: Re : [algogeeks] Re: size of self referential structure

2011-07-26 Thread kavitha nk
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,

Re: Re : [algogeeks] Re: size of self referential structure

2011-07-26 Thread vaibhav shukla
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 kavithan...@gmail.com wrote: sry frendzma above posts were wrongans is 28 if ptr takes 4 bytes... //BE COOL// kavi -- You received this message

Re: Re : [algogeeks] Re: size of self referential structure

2011-07-26 Thread sunny agrawal
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 vaibhav200...@gmail.comwrote: 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