---
title: "char   char = int? Why?"  
description: "char   char = int? Why?"  
author: "Royce Roy"  
published: 2013-06-06  
updated: 2013-06-06  
canonical: https://www.mindstick.com/forum/1000/char-char-int-why  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# char   char = int? Why?

Hi All,\
Why is adding two char in C# [results](https://yourviews.mindstick.com/story/4497/usage-of-baking-soda-magical-results) to an [int](https://www.mindstick.com/forum/159137/how-to-convert-date-int-to-date-in-sql) type?\
For example, when I do this:\
[var](https://www.mindstick.com/forum/33920/what-is-different-var-and-dynamic-types-in-c-sharp) pr = 'R' + 'G' + 'B' + 'Y' + 'P';the pr [variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation) becomes an int type. I expect it to be a [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) type with a [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) of "RGBYP".\
Why is C# designed like this? Wasn't the [default](https://www.mindstick.com/interview/12771/what-is-the-importance-of-default-resources) [implementation](https://www.mindstick.com/forum/33764/how-to-implementation-of-class-in-c-sharp) of adding two chars should be resulting to a string that concatenates the chars, not int?\
Thanks in advance. \

## Replies

### Reply by AVADHESH PATEL

Hi,\
You can simply convert the first of your chars to a string, to outwit your compiler:\
**var pr = 'R'.ToString() + 'G' + 'B' + 'Y' + 'P';****\**You could also define a char array and then use the string constructor:\
**char[] letters = { 'R', 'G', 'B','Y', 'P' };****\**string alphabet = new string(letters);If you want to print out a character solely, you always have to convert it to a string, to get its text representation:\
**var foo1 = 'F';** **MessageBox.Show(foo1.ToString());****\**Thanks in advance.


---

Original Source: https://www.mindstick.com/forum/1000/char-char-int-why

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
