Passing pointers to C macro modules

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Pyhis
Posts: 2
Joined: Mon Aug 12, 2013 5:46 pm
Has thanked: 1 time
Contact:

Passing pointers to C macro modules

Postby Pyhis » Mon Aug 12, 2013 5:54 pm

Hi

I am trying to use a function like this in flowcode. I am passing 4 variables and declaring pointers to them, and in the function I am
changing the values of the variables with pointers. Is this possible to make to a macro block or something similar? I am trying to avoid global variables.
If this is not possible, how would you do it?

Code: Select all

 char readDHT22(short *temp_integer, char *temp_decimal, char *hum_integer,char *hum_decimal) {


Regards,
Kristian

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 64 times
Been thanked: 306 times
Contact:

Re: Passing pointers to C macro modules

Postby JonnyW » Wed Aug 14, 2013 12:47 pm

Hello.

What version of Flowcode are you using? If you wish to pass variables like this to an existing C function in v5 or below you can use a C code icon. If you wish to create a Flowcode macro, this will only allow passing of parameters as strings at present.

This changes with v6 and you can pass arrays into macros no problems. Passing by-ref (so you can modify the values) is allowed.

We are going to an open Beta hopefully today so you will be able to download and test this. Keep an eye on this post for details.

Jonny
These users thanked the author JonnyW for the post:
Pyhis (Wed Aug 14, 2013 6:10 pm)
Rating: 5.56%
 

Pyhis
Posts: 2
Joined: Mon Aug 12, 2013 5:46 pm
Has thanked: 1 time
Contact:

Re: Passing pointers to C macro modules

Postby Pyhis » Thu Aug 15, 2013 6:29 am

How do you include your own .h and .c files to your project, so you can use the function with the C icon.

I really like visual representation of the flowcode, but I think it is a little too restricted.
There should be a place where you can include your own header files.

Kristian