簡體   English   中英

變量名后的括號是否在C編程中有效?

[英]parenthesis after variable name is valid or not in C programming?

我只是嘗試在C中用括號“ n_() ”創建變量,但是它不起作用,這給了我錯誤。 有人可以告訴我其中的問題嗎? 在此處輸入圖片說明

在C中, int n_(); 聲明返回int的函數,而不是變量。 ()不是,也不能是標識符名稱的一部分。

如果您在標准中看到標識符的定義,您將獲得。

identifier:
   identifier-nondigit
   identifier identifier-nondigit
   identifier digit

identifier-nondigit:
   nondigit
   universal-character-name
   other implementation-defined characters

 nondigit: one of
    _abcdefghijklm
    nopqrstuvwxyz
    ABCDEFGHIJKLM
    NOPQRSTUVWXYZ

digit: one of
    0123456789

標識符只能以非數字的值開頭,並且以非數字和數字的值作為元素

abc, a1234, __abc, ab_c都是有效的標識符。

1abc, abc+, abc(, ab-c,是無效的標識符。

PS universal-character-name定義如下

universal-character-name:
   \u hex-quad
   \U hex-quad hex-quad

hex-quad:
    hexadecimal-digit hexadecimal-digit
    hexadecimal-digit hexadecimal-digit

它們用於指代不在基本字符集中的字符。 例如\\ u0024($),\\ u0040(@)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM