Why Asterisk Is Used in C++?

Why Asterisk Is Used in C++?

The asterisk ( * ) has two distinct meanings within C in relation to pointers, depending on where it's used. ... When used with an already declared variable, the asterisk will dereference the pointer value, following it to the pointed-to place in memory, and allowing the value stored there to be assigned or retrieved.

Why do we use * in C?

“*” Operator is used as pointer to a variable. ... & operator is used to get the address of the variable. Example: &a will give address of a.

What are asterisks used for in C?

The asterisk is the unary * operator. It is not the * multiplication operator. Pointers must be initialized before they can be used. Initialize a pointer by assigning it to a variable; the variable must be of the same type as the pointer.

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.