How to input an empty string in the C programming language?

In C language, an empty string can be input in two ways.

  1. Using blank space or line break as the content of a string, for example:
char str[] = " "; // 使用空格符号作为空字符串
char str[] = "\n"; // 使用换行符作为空字符串
  1. Representing an empty string with an empty character array, for example:
char str[] = ""; // 空的字符数组表示空字符串

An empty string can be represented in any way.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds