Skip to content

Latest commit

 

History

History
50 lines (46 loc) · 1.62 KB

File metadata and controls

50 lines (46 loc) · 1.62 KB
title Cast Operators | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-language
ms.tgt_pltfrm
ms.topic article
dev_langs
C++
helpviewer_keywords
cast operators
type casts, operators
operators [C++], cast
type conversion, cast operators
ms.assetid 43b90bbd-39ef-43e6-ae5d-e8a67a01de40
caps.latest.revision 8
author mikeblome
ms.author mblome
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

Cast Operators

A type cast provides a method for explicit conversion of the type of an object in a specific situation.

Syntax

cast-expression:
unary-expression

( type-name ) cast-expression

The compiler treats cast-expression as type type-name after a type cast has been made. Casts can be used to convert objects of any scalar type to or from any other scalar type. Explicit type casts are constrained by the same rules that determine the effects of implicit conversions, discussed in Assignment Conversions. Additional restraints on casts may result from the actual sizes or representation of specific types. See Storage of Basic Types for information on actual sizes of integral types. For more information on type casts, see Type-Cast Conversions.

See Also

Cast Operator: ()