int **p;
p = (int **)malloc(sizeof(int *)*row);
for(i = 0;i<row;i++)
       p[i] = (int *)malloc(sizeof(int)*column);

On 6/30/11, Apoorve Mohan <[email protected]> wrote:
> though thankx :)
>
> On Thu, Jun 30, 2011 at 12:44 AM, Apoorve Mohan
> <[email protected]>wrote:
>
>> @above: man i need a 2d array not a 1d array...
>>
>>
>> On Thu, Jun 30, 2011 at 12:38 AM, hary rathor
>> <[email protected]>wrote:
>>
>>>
>>> #include<stdlib.h>
>>>
>>> int main ()
>>> {
>>>     int *mat;
>>>     int i,j;
>>>     int ROW=4;
>>>     int COL=3;
>>>     int k=0;
>>>     mat=(int *)malloc(ROW*COL*sizeof(int));
>>>
>>>    for(i=0;i<ROW;i++)
>>>    for(j=0;j<COL;j++)
>>>    mat[i*COL+j]=++k;
>>>
>>>    for(i=0;i<ROW;i++)
>>>    for(j=0;j<COL;j++)
>>>    printf("%d,",mat[i*COL+j]);
>>>
>>>     return 0;
>>>
>>> }
>>>
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> regards
>>
>> Apoorve Mohan
>>
>>
>
>
> --
> regards
>
> Apoorve Mohan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=100000655377926 *

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to