Programming

c - Why (and when) do I need to use parentheses after sizeof? - Stack Overflow

steloflute 2023. 10. 4. 23:46

c - Why (and when) do I need to use parentheses after sizeof? - Stack Overflow

 

Why (and when) do I need to use parentheses after sizeof?

The below fails to compile: typedef int arr[10]; int main(void) { return sizeof arr; } sizeof.c:3: error: expected expression before ‘arr’ but if I change it to sizeof(arr); everything is ...

stackoverflow.com

 

According to 6.5.3, there are two forms for sizeof as the following:

sizeof unary-expression
sizeof ( type-name )

 

'Programming' 카테고리의 다른 글

C언어의 feof() 함수 사용에 대해  (1) 2023.10.05
Run C# scripts with .NET Core  (1) 2023.10.04
Quasiquotation in Lisp (Bawden)  (0) 2023.10.02
Executing Shell Commands with Python  (0) 2023.09.23
Microsoft LISP  (0) 2023.09.21