>>pst = (A*)malloc(sizeof(A)*1);
1. The "*1" is unnecessary and spurious.
2. C programs do not require typecasting. So remove that typecast. If your compiler complains then your are apparently writing a c++ program.
3. Move that structure above the functuion main() so that it is visible to all other functions. Then change function1 parameter to use that structure instead of passing a void pointer. You will need to change the function prototype at the top of your program too.
void function1(A *pStr)
{
// blabla
}
4. Come up with a better naming convention than "A". That is a sure sign of poor programming habits. You are new at this, so learn the right way at the very start.
Last edited by Ancient Dragon; Oct 18th, 2006 at 10:30 am.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Offline 21,953 posts
since Aug 2005