In an attempt to avoid the very annoying "inline" error and with the goal to make cleaner code I have written a PID control loop that you can create multiple instances of (hopefully).This part of the code successfully compiles:

In the original C programming language, you couldn't put functions inside structs (and neither can you in RobotC). It wasn't until C++ that this was possible. However, you can write functions that accept pointers to a struct, and thereby create pseudo-member functions for data structures.

Thu Dec 20, 2012 6:17 pm

magicode

Moderator

Joined: Tue Sep 14, 2010 9:19 pmPosts: 496

Re: Functions with return statments inside of structs

I think you're looking for "function pointers". Unfortunately, I do not think that these are implemented in ROBOTC yet (At least, I don't think that they are. Someone please correct me if I'm wrong).

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum