Given your restrictions on what you can do, nothing can be done to fix your code.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
>>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.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343