Can you pass the value of a local variable to another function?

0

I have a local variable in my function main . Can data of that variable be passed to any function? For example, move from main to function x , the value of variable k

    
asked by Fernando Withmore 27.11.2017 в 23:57
source

1 answer

0

If the 'function x' is called within the main () function, this is possible.

Main()
    {
        variable k;       
        k= valor;

       FuncionX(k);
    }

otherwise you need the variable 'k' to be global.

variable k; 
Main()
    {            
        k= valor;       
    }

FuncionX(variable)
    {            
        k= valor;       
        ...
    }
    
answered by 28.11.2017 / 00:40
source