no. of rows is 3
size of (*p) is 12
then how can 48 be the no. of bytes ??

On Sat, Sep 3, 2011 at 8:32 AM, Deepak Garg <deepakgarg...@gmail.com> wrote:

> +1
>
>
> On Sat, Sep 3, 2011 at 8:57 PM, Ankuj Gupta <ankuj2...@gmail.com> wrote:
>
>> p is a pointer to an array of 4 integers. So when you do (int(*)
>> [col])malloc(row*sizeof(*p)) total of 48 bytes is allocated as
>> sizeof(*p) is 12 bytes.
>>
>> On Sep 3, 4:14 pm, rohit <rajuljain...@gmail.com> wrote:
>> > how many bytes are allocated by following code?
>> >
>> > #include<alloc.h>
>> > #define col 4
>> > #define row 3
>> >
>> > int main()
>> > {
>> > int(*p)[col];
>> > p=(int(*)[col])malloc(row*sizeof(*p));
>> >
>> > return 0;
>> >
>> > }
>> >
>> > please explain answer?
>>
>> --
>> 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, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> U.D.I.T
>
> Sent by Nokia OVI (c)
>
>  --
> 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, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Piyush Agarwal
Final Year Undergraduate
Department of Computer Engineering
Malaviya National Institute of Technology
Jaipur

-- 
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, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to