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.

Reply via email to