malloc allocates memory and returns a pointer to the beginning of that block of memory. You need to assign it to some pointer not an object as you are doing here. Change that to pointer and it should work.
i couldnt really understand your 2nd qs, would be helpful if you attached the files also.
Agni
Practically a Master Poster
674 posts since Dec 2007
Reputation Points: 431
Solved Threads: 119
Skill Endorsements: 4
And please check for succesful allocation and if yes then dont fgt to free this block of memory once you'r done
Agni
Practically a Master Poster
674 posts since Dec 2007
Reputation Points: 431
Solved Threads: 119
Skill Endorsements: 4