Why testvariable is not incremented?

function incrementvariable(numb)
    numb += 1
end
function testing()
    global testvariable = 0
    for i = 1:3
        incrementvariable(Ptr{testvariable})
    end
    println(testvariable)
end

Or actually what should I change to get the testvariable incremented? I'm 
counting how many times one case inside the function incrementvariable is 
called. I will use this information later in the testing() function. 

This will work, but it doesn't look elegant:
function incrementvariable(numb)
    numb[1] += 1
end
function testing()
    testvariable = [0]
    for i = 1:3
        incrementvariable(testvariable)
    end
    println(testvariable)
end

 

Reply via email to