moha_sa Posted February 12, 2022 Share Posted February 12, 2022 Hi, I am receiving this error "implicit declaration of function 'malloc' " when using servoData = (char *)malloc(CHAR_BUF_SIZE_3*sizeof(unsigned char)); in a user-defined ServoCtrl algorithm in the Realtime Routines folder in the IDE. My goal is to use sprintf and send commands to be able to print a float variable to the unsolicited message window and monitor its value as below: char *servoData; servoData = (char *)malloc(CHAR_BUF_SIZE_3*sizeof(unsigned char)); sprintf(servoData,"desired position is %f \n", 230.5); Send(SEND1_PORT,servoData); Any idea how I can still use "malloc" without the error to run the "Send" command? Thanks. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.