0 points
15 11 8

Pointers are good to have in your program. But also can be difficult to learn. “Indirection Requires Pointer Operand ('Int' Invalid)” is an error which occur because of a pointer. I give the cause and the solution of the error below.


The error message means that the programmer applied to dereference to a pointer to an integer. This means that a pointer is declared to a long integer. For instance, a pointer can only contain memory addresses, and thus the wrong length is applied to the pointer.


The following are some ways to solve the above error:

  • passing a string representation of an integer into int
  • passing a string representation of a float into float
  • passing a string representation of an integer into float
  • passing a float into int
  • passing an integer into float

The method that can be used to solve the error is by converting the string to a numeric value. A string that contains a real value, not an integer should be created. The strategy invokes the float () builtin function that returns an actual value that can be attributed to the pointer.

For example:


This converts the string to a floating- point value which is converted to an integer through truncation and removing the fractional part. The value reduces the pointer from long integer thus the error will be solved.

More Posts

Indirection Requires Pointer Operand Lalit Kumar - Sep 9, 2020
No operator << matches these operands C++ Lalit Kumar - Sep 15, 2020
What does void do in C++? Lalit Kumar - Sep 6, 2020
Array of pointers to object in C++ Lalit Kumar - Aug 11, 2020
what are the differences between pointer variable and a reference variable in C++? - Apr 6, 2020
Invalid types ‘int[int]’ for array subscript Lalit Kumar - Oct 5, 2020
Pass a pointer to a function in C sakshi - Jul 11
ERROR (pointer being freed was not allocated) Lalit Kumar - Jun 30, 2020
No operator matches these operands C++ Lalit Kumar - Apr 22, 2020
ERROR invalid type argument of unary '*' (have 'int') Lalit Kumar - Jun 26, 2020