---
title: "Char datatype in C-language"  
description: "Char datatype in C-language"  
author: "Prakash nidhi Verma"  
published: 2018-07-10  
updated: 2020-09-22  
canonical: https://www.mindstick.com/interview/23462/char-datatype-in-c-language  
category: "c#"  
tags: ["c#", "variable"]  
reading_time: 1 minute  

---

# Char datatype in C-language

Char datatype in c language:

The memory allocated to a character variable is 1 byte while memory allocated to character constant is 4 byte because it returns ASCII value.

```
#include<stdio.h> int main() {  char s='a';  printf("%d",(int)sizeof(s));    printf("%d",(int)sizeof('a'));  return 0;}
```

```
char ch1 = 'a'; char ch2 =  ch1;
```

## Answers

### Answer by Prakash nidhi Verma

Char datatype in c language:

The memory allocated to a character variable is 1 byte while memory allocated to character constant is 4 byte because it returns ASCII value.

```
#include<stdio.h> int main() {  char s='a';  printf("%d",(int)sizeof(s));    printf("%d",(int)sizeof('a'));  return 0;}
```

```
char ch1 = 'a'; char ch2 =  ch1;
```


---

Original Source: https://www.mindstick.com/interview/23462/char-datatype-in-c-language

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
