brel-logo-white brel-logo-white
  • Travel
  • Case Study
  • How to
  • Technology
  • More
    • Sports
    • Health
    • Articles
    • Review
Notification
  • HomeHome
  • Finance
  • Health
  • Lifestyle
  • Sports
  • Contact Us
BreldigitalBreldigital
  • HomeHome
  • Finance
  • Health
  • Lifestyle
  • Sports
  • Contact Us
Search
  • Quick Access
    • Home
    • History
    • My Saves
    • My Interests
    • My Feed
  • Categories
    • Travel
    • Sports
    • Health

Top Stories

Explore the latest updated news!

Stephanie puts 30 cubes in a box

Which statement correctly describes the process that occurs in the thylakoid?

Which point is on the line that passes through point h and is perpendicular to line fg?

Stay Connected

Find us on socials
248.1k Followers Like
61.1k Followers Follow
165k Subscribers Subscribe
Breldigital > Blog > ds > What is a null character
ds

What is a null character

By John Published November 10, 2022
Share

This C Tutorial explains NULL Character in C with examples.
In C programming, character strings are terminated by NULL Byte. The representation for NULL Byte is ‘\0’ or ‘0’ (zero) or NULL. This way we wouldn’t be able to use NULL character in ours’ strings. Then why NULL character and not any other is used as a string terminator? Firstly, C doesn’t have explicit “string data type” and so how strings, an integral component, of everyday requirement to be handled? This requires to use some character to terminate the character arrays so the same could be treated as strings. Then which character? And why NULL character? The fact is NULL character doesn’t have any graphic printable symbol associated with it and consequently not required and this is why it’s used as a string terminator.

Recall that character strings and string literals are each terminated by NULL byte. String literal, however, doesn’t have visible NULL terminator. Compiler provides every string literal a NULL terminator while compiling the program. But character arrays may or may not contain NUL terminator. Character arrays which contain terminating NULL byte are strings. For example:

char season[] = {‘a’,’u’,’t’,’u’,’m’}; /* character array */
char country[] = {‘I’,’n’,’d’,’i’,’a’,’\0′}; /* character string */

char *str = “Hello, how are you?”;
/* string literal: No visible NULL terminator */

TAGGED: What is a null character
John November 10, 2022 November 10, 2022

Search

brel-logo-white brel-logo-white
Explore a wide range of brands and categories with our comprehensive coverage, and stay up-to-date with the latest news and trends by subscribing to our updates.
Categories:
  • Entertainment
  • Travel
  • Sport
  • Contact Us

Quick Links

  • My Feed
  • My Interests
  • History
  • My Saves

About US

  • Adverts
  • Our Jobs
  • Term of Use

© 2023 Brel Digital All Rights Reserved. All logos and images used on this website are registered trademarks of their respective companies

Welcome Back!

Sign in to your account

Lost your password?