I am trying to make a function that returns double the integer number that I will pass to it. I am getting the following error message with my code:
declaration of ‘int x’ shadows a parameter int x; “
Here is my code:
#include <iostream> int doublenumber(); using namespace std; int doublenumber(int x)// <-- this is the function which returns double the value . { int x; return 2 * x; cout << endl; } int main() { int a; cout << "Enter the number that you want to double it : " << endl; cin >> a; doublenumber(a); return 0; }
Related Posts:
- C++ — expected primary-expression before ‘ ‘
- Return array in a function
- Meaning of = delete after function declaration
- How to concatenate a std::string and an int
- Alternative to itoa() for converting integer to string C++?
- invalid use of non-static member function
- Reverse Contents in Array
- c++: No instance of overloaded function
- error: expected primary-expression before ‘)’ token (C)
- Fill array with random numbers within a specified range (C++)
- error: “initializer expression list treated as compound expression”
- Getting error: ISO C++ forbids declaration of with no type
- Function for C++ struct
- c++ –
- C++ – statement cannot resolve address for overloaded function
- How do I return a char array from a function?
- How to return a struct from a function in C++?
- Why can’t we pass arrays to function by value?
- template argument deduction/substitution failed, when using std::function and std::bind
- how to convert from int to char*?
- ERROR: Control may reach end of non-void function /
- function does not take 1 arguments c++
- C++ correct way to return pointer to array from function
- Difference between function arguments declared with & and * in C++
- C++ floating point to integer type conversions
- Is C++ Array passed by reference or by pointer?
- “cannot be used as a function error”
- Floating point exception( core dump
- Passing Arrays to Function in C++
- Regular cast vs. static_cast vs. dynamic_cast
- What is an unsigned char?
- C++ std::priority_queue uses the lambda expression
- When to use reinterpret_cast?
- Expression must be a modifiable lvalue
- Single class has a Class Redefinition Error
- Identifier not found error on function call
- Debug assertion failed. C++ vector subscript out of range
- What causes a SIGABRT fault?
- Graphics Library for C++
- ‘cout’ was not declared in this scope
- What is the difference between const int*, const int * const, and int const *?
- TranslateName() function doesn’t work on win10
- How to use the PI constant in C++
- How to concatenate two strings in C++?
- warning: ISO C++ forbids variable length array
- cin >> “no operator matches these operands”
- C++ Structure Initialization
- expression preceding parentheses of apparent call must have (pointer-to-) function type
- Enum to String C++
- Random float number generation
- C++ terminate called without an active exception
- MinGW: “gcc is not recognized as an internal or external command”
- Convert Python program to C/C++ code?
- How to debug ‘Stack smashing detected’?
- C++ #include guards
- glm rotate usage in Opengl
- warning: control reaches end of non-void function [-Wreturn-type]
- Program received signal SIGSEGV, Segmentation fault
- gcc/g++: “No such file or directory”
- Error: expected type-specifier before ‘ClassName’
- error: member access into incomplete type : forward declaration of
- Debug assertion failed
- “Implicit instantiation of undefined template” when forward declaring template class
- “…redeclared as different kind of symbol”?
- Error “system” is ambiguous?
- What does “Permission denied” “Id returned 1 exit status” mean?
- When does an Incomplete Type error occur in C++
- std::cin input with spaces?
- extended initializer lists only available with
- Is there a standard C++ grammar?
- invalid use of non-static data member
- C: using strtol endptr is never NULL, cannot check if value is integer only?
- use of class template requires template argument list
- Why would this give a Use of uninitialised value of size 8
- C++ Error: Type Name is Not Allowed
- Why I cannot cout a string?
- c++ reading csv file
- Why do you use typedef when declaring an enum in C++?
- Class template inheritance C++
- C++ error: undefined reference to ‘clock_gettime’ and ‘clock_settime’
- Converting String to Cstring in C++
- creating dynamic array of string c++
- How well is Unicode supported in C++11?
- The CXX compiler identification is unknown
- Initializing pointers in C++
- Static vs dynamic type checking in C++
- “No rule to make target ‘install'”… But Makefile exists
- How to determine the version of the C++ standard used by the compiler?
- Make / gcc cryptic error 2: how to have more information?
- REGSVR32: the module “xxxxx.dll” failed to load … dependent assembly could not be found
- Error: expression cannot be used as a function?
- What is a .h.gch file?
- What does “warning: not all control paths return a value” mean? (C++)
- Array of Linked Lists C++
- Is it still safe to delete nullptr in c++0x?
- Declaration is incompatible with type
- One or more multiply defined symbols found
- I’m getting the error “stoi is not a member of std” in myprogramminglab [duplicate]
- Template constructor in a class template – how to explicitly specify template argument for the 2nd parameter?
- C++ float array initialization