1 Error C2664
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this error c2664 cannot convert parameter 1 from site About Us Learn more about Stack Overflow the company Business Learn more
Error C2664 Cannot Convert Argument 1 From
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss error c2664 in c++ Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up error C2664: cannot
Error C2664 Lpcwstr
convert parameter 1 from 'int' to 'int []' up vote 0 down vote favorite #include using namespace std; class amin { private: const int length = 10; int newArray[length]; int i; public: int deleteEvenNumber(int getArray[length]) { for (i = 0 ; i < length ; i++) { if (getArray[i] % 2 == 0) newArray[i] = getArray[i]; i++; }; return newArray[length]; }; }; main: error c2664 cannot convert parameter from const char to lpcwstr int main() { amin manipulateArrays; int input , i = 0; const int length = 10; int mainArray[length]; cout<<"Please enter ten numbers :"<>input; mainArray[i] = input; i++; }; manipulateArrays.deleteEvenNumber(mainArray[length]); }; i got these two errors: error C2664: 'amin::deleteEvenNumber' : cannot convert parameter 1 from 'int' to 'int []' IntelliSense: argument of type "int" is incompatible with parameter of type "int *" please help and explain about my mistake to me. and please introduce a good tutorial for this problem or this title to me. c++ casting share|improve this question edited Mar 3 '14 at 15:23 herohuyongtao 25.3k96690 asked Mar 3 '14 at 15:13 Amin Khormaei 492312 I would use a std::vector rather than arrays. –Nick Mar 3 '14 at 15:17 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote accepted Your function deleteEvenNumber() requires an int [] (i.e. int array), however you passed it an int to it. manipulateArrays.deleteEvenNumber(mainArray[length]); ^^^^^^^^^^^^^^^^^ | this is an 'int', not an 'int []' To also pass the length to the function, you may want to change yo
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the
Error C2664 In Visual C++
workings and policies of this site About Us Learn more about Stack
C2664 Cannot Convert Parameter 1 From
Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs error c2664 visual studio Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; http://stackoverflow.com/questions/22150353/error-c2664-cannot-convert-parameter-1-from-int-to-int it only takes a minute: Sign up error C2664: cannot convert parameter 1 from 'X' to 'X' up vote 1 down vote favorite I have a C++/Win32/MFC project in Visual Studio 2008, and I'm getting a strange error message when I compile it. I've created a small project to demonstrate the problem, and the main code is #ifndef _MyObject_h http://stackoverflow.com/questions/14713648/error-c2664-cannot-convert-parameter-1-from-x-to-x #define _MyObject_h class MyObject { public: MyObject() { } }; #endif // _MyObject_h // --- END MyObject.h // --- BEGIN ObjectData.h #ifndef _ObjectData_h #define _ObjectData_h template class ObjectData { public: DataPolicy *data; ObjectData() : data(NULL) { } ObjectData(const ObjectData ©) : data(copy.data) { } ObjectData & operator=(const ObjectData ©) { this->data = copy.data; return *this; } }; #endif // _ObjectData_h // --- END ObjectData.h // --- BEGIN Tool.h #ifndef _Tool_h #define _Tool_h #include "ObjectData.h" template class Tool { private: ObjectData _object; public: Tool(ObjectData obj); }; #endif // _Tool_h // --- END Tool.h // --- BEGIN Tool.cpp #include "stdafx.h" #include "Tool.h" template Tool::Tool(ObjectData obj) : _object(obj) { } // --- END Tool.cpp // --- BEGIN Engine.h #ifndef _Engine_h #define _Engine_h #include "Tool.h" #include "MyObject.h" class Engine { private: MyObject *_obj; public: Engine(); ~Engine(); void DoSomething(); }; #endif // _Engine_h // --- END Engine.h // --- BEGIN Engine.cpp #include "stdafx.h" #include "Engine.h" Engine::Engine() { this->_obj = new MyObject(); } Engine::~Engine() { delete this->_obj; } void Engine::DoSomething() { ObjectData objData; obj
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads http://stackoverflow.com/questions/28003599/c-error-c2664-cannot-convert-argument-1 with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign http://cboard.cprogramming.com/cplusplus-programming/86608-error-c2664-cannot-convert-parameter-1-int-int-[].html up c++ error C2664 cannot convert argument 1 up vote 0 down vote favorite I'm creating a binary tree and I'm trying to implement a function for creating that tree. So that is the code for every member of the tree error c2664 template struct Node { T data; Node* left; Node* right; Node() { data = NULL; left = NULL; right = NULL; } }; The "BinaryTree" class have only one member called "root" whose type is Node and my function for creating the tree is: void CreateTree(istream &in) { char help; int data; in >> help; while (help == 'y') { in >> data; addLeaf(root, data); in >> help; } } and the addLeaf function is: void addLeaf(Node* &nod, int data) { c2664 cannot convert if (nod == NULL) { nod = new Node(); nod->data = data; } else if (data < nod.data) addLeaf(nod->left, data); else addLeaf(nod->right, data); } The result is: error C2664: 'void BinaryTree::addLeaf(Node *&,int)' : cannot convert argument 1 from 'Node' to 'Node *&' What should I do? c++ share|improve this question edited Jan 17 '15 at 19:51 Borgleader 11.4k42342 asked Jan 17 '15 at 19:50 Никола Хилендаров 638 4 The type of root is Node or Node* ? –P0W Jan 17 '15 at 19:53 3 The compiler says exactly what is wrong. root is a Node but addLeaf expects a Node*&. –Raymond Chen Jan 17 '15 at 20:04 Thank you, that was my mistake –Никола Хилендаров Jan 17 '15 at 20:05 add a comment| active oldest votes Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook. Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Browse other questions tagged c++ or ask your own question. asked 1 year ago viewed 1171 times Linked 24 Why pointers to a reference is illegal in C++? Related 1error C2664: 'way' : cannot convert parameter 4 from 'int' to 'int &'0error C2664 :cannot convert argument from 'Node
Programming Boards C++ Programming error C2664: cannot convert parameter 1 from 'int' to 'int []' Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get a compiler | Fixes for common problems Thread: error C2664: cannot convert parameter 1 from 'int' to 'int []' Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 12-15-2006 #1 mai077 View Profile View Forum Posts Registered User Join Date Dec 2006 Posts 4 error C2664: cannot convert parameter 1 from 'int' to 'int []' Hello all. I'm so new in C++ Programming that a simple problem seems extremely difficult!! The only thing that I have to do is to calculate the sum, the average, the max and the min of 10 numbers given by the user!! My code is: Code: #include using namespace std; int count_sum(int numbers_par[]); void count_max(int numbers_par[]); void count_min(int numbers_par[]); int main() { int numbers[10]={0,0,0,0,0,0,0,0,0,0}; int sum; double average; cout<<"Enter 10 integers.\n"; for(int i=0; i<10; i++) cin>>numbers[i]; sum = count_sum(numbers[10]); average = sum/10.0; cout<<"average "<max) max=numbers_par[i]; cout<<"max "<