---
# System prepended metadata

title: '''\0'' and ''\n'' is difference in C/C++'

---

# '\0' and '\n' is difference in C/C++


## In ASCII table
'\0' means the null value in ascii is '0'== zero

'\n' means the newline in ascii is '10' == ten

## In string what we read

If we read a string 'Hello,World!', the computer will see 
**H e l l o , W o r l d ! \n**

Not

**H e l l o , W o r l d ! \0**

## About fopen() in "stdio.h" or "cstdio"

so if you want to use fopen(), then you have to change the last character from \n to \0, or you can't open the file in correct.

## About strlen() in "string.h"

In <string.h> strlen will count \n to be a character so if you use strlen(Hello,World!),
you will get len 13.

