Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions docs/error-messages/compiler-errors-1/compiler-error-c2101.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
---
description: "Learn more about: Compiler Error C2101"
title: "Compiler Error C2101"
ms.date: "11/04/2016"
ms.date: "03/04/2024"
f1_keywords: ["C2101"]
helpviewer_keywords: ["C2101"]
ms.assetid: 42f0136f-8cc1-4f2b-be1c-721ec9278e66
---
# Compiler Error C2101

'&' on constant

The address-of operator ( `&` ) must have an l-value as operand.
The [address-of operator (**`&`**)](../../cpp/address-of-operator-amp.md) must have an l-value as operand.

The following sample generates C2101:

```cpp
// C2101.cpp
int main() {
char test;
test = &'a'; // C2101
test = 'a'; // OK
int main()
{
int* ptr = &123; // C2101
}
```