Math with Pointer

I have 2 float64 values as pointer.

var a *float64
var b *float64

a = 3.5
b = 5.5

a + b = (operator + not defined on pointer)

How I can work with operatoren & Pointer?

This code dos not compile since you can’t assign a float literal to a pointer and you also can’t take the address of a float literal.

Why don’t you work with the floats directly?

When I put a float to 0.0, then the marshaler thinks this keyvalue is empty and leaves it out in json. Is float64 a pointer, then can set the value to 0. Yes I know i can use the schema “json:key, omitempty” but then my updater for the DB won’t work right,

What DB? What updater? How does it consume JSON?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.