Click here to Skip to main content
15,919,358 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using malloc to allocate the memory and free to free the allocated memory..
When I execute the program some junk values coming..
My program functionality is to get the SAP data. Me using the sapnwrc header file...

regards,
sanath
Posted
Comments
CPallini 23-Sep-11 4:07am    
You should post the relevant code to get better help.

1 solution

The most likely reason is that the data you get from malloc is not initialized to any particular value. If your program does not set some of that data before you use it, then you will have unpredictable results. Either change your program to always set sensible values, or use memset to set a particular value, or use calloc instead of malloc to allocate pre-initialized memory.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900