Link to home
Start Free TrialLog in
Avatar of sinacetiner
sinacetiner

asked on

malloc in unix

hi i wrote  a program in mandrake 9.1 version. ı had to use two dimensional array
char **inputdata;
int count;
inputdata = (char**)malloc(10*sizeof(char));
works correctly but after this ı wrote
for(count=0;count<9;++count)
inputdata[count] = (char*)malloc(5*sizeof(char));

first allocation step wroks correctly(for char**) but second doesnt.
there is no compile mistake.also this code works in mandrake 9.1 version but because of malloc problem it does not work my school's unix server. &#305; tried many ways.
if any one interests with whole code &#305; can send. pls mail at sinacetiner@yahoo.com for whole code
ASKER CERTIFIED SOLUTION
Avatar of rstaveley
rstaveley
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sunnycoder
Hi sinacetiner,

> inputdata = (char**)malloc(10*sizeof(char));
inputdata = (char**)malloc(10*sizeof(char*));


Cheers!
Sunny:o)