Thank you very much. That solved my problem. blush

Edit: So far so good. This example works fine, but it doesn't work in my main programm. Therefore I've searched the mistake in my programm and I came to the conclusion that the 'wait' command makes the pointer invalid.
What's the reason for this ?
New code:
Code:
#include <acknex.h>
#include <default.c>

function main()
{
 // 'min' shall point on the value of the smallest variable
 var x = 6,y = 5;
 var* min=NULL;
 
 if(x < y)
    min = &x;
 else
    min = &y;
 
 // output 'min'
printf(_chr( str_cat(str_create("Min: "), (str_for_num(NULL,*min) ))) );
 
 // determine, whether 'min' is bigger than 4
 if (*min > 4.0)
    printf(">4");
 else
    printf("<=4");
 printf(_chr( str_cat(str_create("Min: "), (str_for_num(NULL,*min) ))) ); // 5 -> ok  
 y+=5;
 printf(_chr( str_cat(str_create("Min: "), (str_for_num(NULL,*min) ))) ); // 10 -> ok
 wait(1);
 printf(_chr( str_cat(str_create("Min: "), (str_for_num(NULL,*min) ))) ); // rubish (often 0) -> wtf !?
}


Output: "Min: 5" , ">4" , "Min: 5" , "Min: 10" , "Min: 0"
Thanks for help.

Last edited by Nicros; 06/23/15 13:50. Reason: New problem :(