It is a pointer to a char
.
When declaring a pointer, the asterisk goes after the type and before the identifier, with whitespace being insignificant. These all declare char
pointers:
char *pointer1; char* pointer2; char * pointer3; char*pointer4; // This is illegible, but legal!
To make things even more confusing, when declaring multiple variables at once, the asterisk only applies to a single identifier (on its right). E.g.:
char* foo, bar; // foo is a pointer to a char, but bar is just a char
It is primarily for this reason that the asterisk is conventionally placed immediately adjacent to the identifier and not the type, as it avoids this confusing declaration.
Related Posts:
- What is uintptr_t data type
- What is uintptr_t data type
- What does int & mean
- What does int & mean
- What are the differences between a pointer variable and a reference variable in C++?
- Return array in a function
- What does “dereferencing” a pointer mean?
- Regular cast vs. static_cast vs. dynamic_cast
- What is a smart pointer and when should I use one?
- What does “dereferencing” a pointer mean?
- What is a char*?
- What exactly is nullptr?
- How to fix a “invalid operands to binary expression” error?
- What is a dangling pointer?
- What does `*&` in a function declaration mean?
- “X does not name a type” error in C++
- (->) arrow operator and (.) dot operator , class pointer
- What is the difference between const int*, const int * const, and int const *?
- C++ – No matching member function for call to ‘push_back’
- What is the difference between const int*, const int * const, and int const *?
- Pointer to incomplete class type is not allowed
- Passing a 2D array to a C++ function
- Can’t resolve Error: indirection requires pointer operand (‘int’ invalid)
- How to create a dynamically-allocated array of const objects, but have values assigned to them?
- How to access the contents of a vector from a pointer to the vector in C++?
- How to make an array with a dynamic size? General usage of dynamic arrays (maybe pointers too)?
- C++: Expression must have a constant value when declaring array inside function
- Sorting Linked List C++ with pointers
- Delete 2D array C++
- Is the sizeof(some pointer) always equal to four?
- C++ Expression must have pointer-to-object type
- C++ strings and pointers
- initial value of reference to non-const must be an lvalue
- Typedef function pointer?
- How to initialize a vector of pointers
- What is the use of intptr_t?
- C++ – Assigning null to a std::string
- error: invalid initialization of non-const reference of type ‘int&’ from an rvalue of type ‘int’
- Using C-string gives Warning: “Address of stack memory associated with local variable returned”
- Reference to non-static member function must be called
- Why use pointers?
- What’s the difference between * and & in C?
- C++ pass an array by reference
- Function stoi not declared
- C++ Array of pointers: delete or delete []?
- Why should I use a pointer rather than the object itself?
- Function stoi not declared
- Incomplete type is not allowed: stringstream
- C++ correct way to return pointer to array from function
- Warning: comparison of distinct pointer types
- Finding the type of an object in C++
- Initializing pointers in C++
- Difference between function arguments declared with & and * in C++
- Is C++ Array passed by reference or by pointer?
- Difference between the int * i and int** i
- set head to NULL (‘NULL’ : undeclared identifier)
- clearing a vector of pointers [duplicate]
- C++ Swapping Pointers
- Array of Linked Lists C++
- Declaration is incompatible with type
- Differences between unique_ptr and shared_ptr
- How do I find the length of an array?
- C++ — expected primary-expression before ‘ ‘
- Using getline() with file input in C++
- lvalue required as left operand of assignment error when using C++
- g++ ld: symbol(s) not found for architecture x86_64
- How do I iterate over the words of a string?
- C++ Vector of pointers
- error: lvalue required as unary & operand
- invalid use of non-static member function
- Cannot open include file: ‘stdio.h’ – Visual Studio Community 2017 – C++ Error
- srand(time(0)) and random number generation
- How to convert integer to double implicitly?
- How do I tokenize a string in C++?
- Reverse Contents in Array
- Why would we call cin.clear() and cin.ignore() after reading input?
- What are the most widely used C++ vector/matrix math/linear algebra libraries, and their cost and benefit tradeoffs?
- Insert object at index of vector c++
- Read whole ASCII file into C++ std::string
- Reading getline from cin into a stringstream (C++)
- How do malloc() and free() work?
- Call to implicitly deleted copy constructor in LLVM
- C++ Linked List Node with class
- Reading string by char till end of line C/C++
- getline: identifier not found
- Colorizing text in the console with C++
- Show two digits after decimal point in c++
- Why am I getting the “Expression is not assignable” error?
- template argument deduction/substitution failed, when using std::function and std::bind
- C++ Global variable declaration
- OpenMP set_num_threads() is not working
- Using cin for char array
- invalid use of ‘this’ outside of a non-static member function error?
- Dev C++ compilation error, permission denied
- convert string to size_t
- Use of ‘const’ for function parameters
- What is the difference between the dot (.) operator and -> in C++?
- Compiler error C4430: missing type specifier – int assumed [duplicate]
- ‘&’ : illegal operation on bound member function expression [duplicate]
- Multiple definitions of “Main”