---
title: ClassicalRegister (v1.0)
description: API reference for qiskit.circuit.ClassicalRegister in qiskit v1.0
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/1.0/qiskit.circuit.ClassicalRegister
---

# ClassicalRegister

*class* `qiskit.circuit.ClassicalRegister(size=None, name=None, bits=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/1.0/qiskit/circuit/classicalregister.py#L50-L57)

Bases: [`Register`](/docs/api/qiskit/1.0/qiskit.circuit.Register "qiskit.circuit.register.Register")

Implement a classical register.

Create a new generic register.

Either the `size` or the `bits` argument must be provided. If `size` is not None, the register will be pre-populated with bits of the correct type.

**Parameters**

- **size** ([*int*](https://docs.python.org/3/library/functions.html#int)) – Optional. The number of bits to include in the register.
- **name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – Optional. The name of the register. If not provided, a unique name will be auto-generated from the register type.
- **bits** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)*\[*[*Bit*](/docs/api/qiskit/1.0/qiskit.circuit.Bit "qiskit.circuit.Bit")*]*) – Optional. A list of Bit() instances to be used to populate the register.

**Raises**

- [**CircuitError**](/docs/api/qiskit/1.0/circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – if both the `size` and `bits` arguments are provided, or if neither are.
- [**CircuitError**](/docs/api/qiskit/1.0/circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – if `size` is not valid.
- [**CircuitError**](/docs/api/qiskit/1.0/circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – if `name` is not a valid name according to the OpenQASM spec.
- [**CircuitError**](/docs/api/qiskit/1.0/circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – if `bits` contained duplicated bits.
- [**CircuitError**](/docs/api/qiskit/1.0/circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – if `bits` contained bits of an incorrect type.

## Attributes

### instances\_counter

Default value: `count(0)`

### name

Get the register name.

### prefix

Default value: `'c'`

### size

Get the register size.

## Methods

### index

`index(bit)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/1.0/qiskit/circuit/register.py#L183-L191)

Find the index of the provided bit within this register.
