Hi All,
I have a typedef element defined inside the struct which i am trying to assign value using the memset and strcpy function.I am able to compile but while running it give me access violation error.Here is my code
can you guide me where i am doing mistake.Is this correct way of accessing the typedef element in a struct.
Thanks for the Help
I have a typedef element defined inside the struct which i am trying to assign value using the memset and strcpy function.I am able to compile but while running it give me access violation error.Here is my code
Code:
**********
#ifndef DEFINE_SAMPLETYPES
#define DEFINE_SAMPLETYPES
typedef char MANUFACTURER_PART_NUMBER[48];
#endif
*******************************************
#ifndef DEFINE_SAMPLE_WKSP
#define DEFINE_SAMPLE_WKSP
#include "SAMPLETYPEDEF.H"
typedef struct{
MANUFACTURER_PART_NUMBER manufacturer_part_number;
}IN_SAMPLE_WKSP;
#endif
****************************
#include "SAMPLE_WKSP.H"
IN_SAMPLE_WKSP *po;
main()
{
memset(&(po)->manufacturer_part_number,' ',48);
strcpy(&(po)->manufacturer_part_number,"hello");
}
Thanks for the Help
Comment