<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFNumberGetValue(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFNumberGetValue"
  },
  "title" : "CFNumberGetValue(_:_:_:)"
}
-->

# CFNumberGetValue(_:_:_:)

Obtains the value of a CFNumber object cast to a specified type.

```
func CFNumberGetValue(_ number: CFNumber!, _ theType: CFNumberType, _ valuePtr: UnsafeMutableRawPointer!) -> Bool
```

## Parameters

`number`

The CFNumber object to examine.

`theType`

A constant that specifies the data type to return. See [`CFNumberType`](/documentation/CoreFoundation/CFNumberType) for a list of possible values.

`valuePtr`

On return, contains the value of `number`.

## Return Value

`true` if the operation was successful, otherwise `false`.

## Discussion

If the argument type differs from the return type, and the conversion is lossy or the return value is out of range, then this function passes back an approximate value in `valuePtr` and returns `false`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)