这个词是什么"字面"意思? [英] What does the word "literal" mean?

查看:214
本文介绍了这个词是什么"字面"意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个词是什么的情况下使用,如文字字符串和文字值时,文字是什么意思?

What does the word "literal" mean when used in context such as literal strings and literal values?

什么是文本值和值之间的区别?

What is the difference between a literal value and a value?

推荐答案

一个文字是对任何记号的重新presenting 源$ C ​​$ C内的值(的wikipedia

A literal is "any notation for representing a value within source code" (wikipedia)

(带的标识的,其中的参照对比这的内存中的值。)

(Contrast this with identifiers, which refer to a value in memory.)

例如:


  • (字符串)

  • (一个布尔值)

  • 3.14 (实数)

  • [1,2,3] (号码列表)

  • (X)=> X * X (功能)

  • / ^ $ 1 |?^(?11 +)\\ 1 + $ / (一正则表达式)

  • "hey" (a string)
  • false (a boolean)
  • 3.14 (a real number)
  • [1,2,3] (a list of numbers)
  • (x) => x*x (a function)
  • /^1?$|^(11+?)\1+$/ (a regexp)

有些东西不是文字:


  • 的std :: COUT (标识符)

  • 富= 0; (声明)

  • 1 + 2 (一个前pression)

  • std::cout (an identifier)
  • foo = 0; (a statement)
  • 1+2 (an expression)

这篇关于这个词是什么"字面"意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆