+ 2

Is it normal this code ? Why ?

Is it normal this code ? #define K(y) \ #y 2021 What will be printed if we use printf on y ?

18th Feb 2022, 4:48 PM
Mik
Mik - avatar
3 Answers
+ 3
its macro directive in c #define K(y) #y as for 2021 i dont know what that does Now if you use this in code like K(123abc) this 123abc will be converted to string and it will be a string "123abc" # - the has is called stringizing operator, but nobody uses macros now
18th Feb 2022, 5:37 PM
ŠœŠ°Ń€Ń‚ŠøŠ½ šŸ˜‘šŸŽµ
ŠœŠ°Ń€Ń‚ŠøŠ½ šŸ˜‘šŸŽµ - avatar
+ 3
ŠœŠ°Ń€Ń‚ŠøŠ½ šŸ˜‘šŸŽµ But back slash \ it normal to use it without n or t Bcause i know that \n is for break line \t for tabulation but \ without nothing i am confuse there
19th Feb 2022, 12:42 AM
Mik
Mik - avatar
+ 3
Those slashes represent new line in bash You can write echo \ 2 \ 3 and this prints 2 3 its same there writing code in new lines
19th Feb 2022, 12:49 AM
ŠœŠ°Ń€Ń‚ŠøŠ½ šŸ˜‘šŸŽµ
ŠœŠ°Ń€Ń‚ŠøŠ½ šŸ˜‘šŸŽµ - avatar