# \[SOLVED\] Exposing double variable (compiler error)

**URL:** <https://community.particle.io/t/solved-exposing-double-variable-compiler-error/6462>\
**Category:** Troubleshooting\
**Created:** [August 19, 2014, 4:42am UTC](https://community.particle.io/t/solved-exposing-double-variable-compiler-error/6462 "2014-08-19T04:42:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![scsc\_tech](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@scsc\_tech](https://community.particle.io/u/scsc_tech)\
**Post date:** [August 19, 2014, 4:42am UTC](https://community.particle.io/t/solved-exposing-double-variable-compiler-error/6462/1 "2014-08-19T04:42:55Z")

</div>

I have a double variable `double tempTime1;` and I want to expose it to read from the API `Spark.variable("tempTime1", &tempTime1, double);` and I get the following compiler error

```
powertarget.cpp: In function 'void setup()':
powertarget.cpp:124:43: error: expected primary-expression before 'double'
```

---

<div class="post-metadata">

**Author:** ![scsc\_tech](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@scsc\_tech](https://community.particle.io/u/scsc_tech)\
**Post date:** [August 19, 2014, 4:51am UTC](https://community.particle.io/t/solved-exposing-double-variable-compiler-error/6462/2 "2014-08-19T04:51:20Z")

</div>

Ridiculous. this was purely a matter of case.

Fixed with  
`Spark.variable("tempTime1", &tempTime1, DOUBLE);`

---

<div class="post-metadata">

**Author:** ![mdma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mdma/32/1924_2.png) [@mdma](https://community.particle.io/u/mdma)\
**Post date:** [August 19, 2014, 11:25am UTC](https://community.particle.io/t/solved-exposing-double-variable-compiler-error/6462/3 "2014-08-19T11:25:47Z")

</div>

Yes, c/c++ is case sensitive, so `FooBar` and `foobar` are different symbols.

---

<div class="post-metadata">

**Author:** ![scsc\_tech](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@scsc\_tech](https://community.particle.io/u/scsc_tech)\
**Post date:** [August 19, 2014, 1:34pm UTC](https://community.particle.io/t/solved-exposing-double-variable-compiler-error/6462/4 "2014-08-19T13:34:16Z")

</div>

Just seemed odd to me that the variable declaration `double tempTime1` was lower yet this had to be upper. Inconsistent for me.

---

<div class="post-metadata">

**Author:** ![mdma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mdma/32/1924_2.png) [@mdma](https://community.particle.io/u/mdma)\
**Post date:** [August 19, 2014, 1:43pm UTC](https://community.particle.io/t/solved-exposing-double-variable-compiler-error/6462/5 "2014-08-19T13:43:58Z")

</div>

Aha! yes, while `double` and `DOUBLE` both say that you want a variable that is floating point, they are not the same thing - there’s a key difference:

- `DOUBLE` tells the **spark cloud** what the type of the variable is - the information **is accessible** to your program.
- `double` tells the **compiler** to allocate space for a floating point variable. This information **is not accessible** to your program (your program can’t ask - what’s the type of this variable? - the compiler assumes you know.)

So you see that `double` is used to allocate the variable to begin with. while `DOUBLE` has to be used to register the variable to the cloud,
