# Casting a slice of char to float

**URL:** <https://ziggit.dev/t/casting-a-slice-of-char-to-float/3734>\
**Category:** Help\
**Tags:** language\
**Created:** [March 28, 2024, 3:55pm UTC](https://ziggit.dev/t/casting-a-slice-of-char-to-float/3734 "2024-03-28T15:55:29Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![efjimm](https://ziggit.dev/user_avatar/ziggit.dev/efjimm/32/5221_2.png) [@efjimm](https://ziggit.dev/u/efjimm)\
**Post date:** [March 29, 2024, 12:20am UTC](https://ziggit.dev/t/casting-a-slice-of-char-to-float/3734/4 "2024-03-29T00:20:01Z")

</div>

Slicing an array gives you a slice, but you need an array to bitcast. Deferencing a slice with a comptime-known length will give you an array, like so:

```zig
const to: f32 = @bitCast(from[i..][0..4].*);

```

---

_[View the full topic](https://ziggit.dev/t/casting-a-slice-of-char-to-float/3734)._
