![]() ![]() The feature you are using here is called "flexible array member". Printf("String test %sn", AllePotMeters.datapacket) ![]() *AllePotMeters.potPointers->datawordPointer = '' *AllePotMeters.potPointers->datawordPointer = 'E' *AllePotMeters.potPointers->datawordPointer = 'D' *AllePotMeters.potPointers->datawordPointer = 'C' *AllePotMeters.potPointers->datawordPointer = 'B' *AllePotMeters.potPointers->datawordPointer = 'A' InitPointersToDatapackett(&AllePotMeters) Void initPointersToDatapackett(overall *allePots)ĪllePots->potPointers = malloc(sizeof(potmeter)) ĪllePots->potPointers->datawordPointer = &allePots->datapacket ĪllePotMeters.datapacket = malloc(AllePotMeters.amountOfPots*BYTES_DATAWORD_POTMETER) Sort of working with *** stack smashing detected ***: terminated Aborted (core dumped) Uint8_t *datapacket // needs to be malloc'ed, don't forget to free it. I can of course put a #define, but is there another way? #include How do I successfully deal with incomplete pointer arrays to a struct? But then after a successful run, I get: *** stack smashing detected ***: terminated It also works with incomplete type *potPointer. The program works with a complete type of *potPointers. The purpose of the program is to fill the "datapacket", but by individually accessible pointers of the potmeter struct. My apologies in advance for the bad-looking code. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |