Tuesday, 29 November 2016

What does the asterisk in C do?




What does the * mean in C? I see it used when declaring a char or FILE variable (char = *test) How does that change how a variable behaves?


Answer



This type of * is called "indirection operator", and *test means "get the data from where the pointer test points".




char is reserved for use as a keyword, so char = *test won't compile unless char is defined as a macro.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...