[Solved] What does *a = *b mean in C? [closed]

[ad_1] *a = *b; The above statement will simply do this: value(a) <– value(b) (i.e. pointer a will contain value ‘d’ ). printf(“%x\n”, a); This will print the pointer’s address(a) in hexadecimal. However, always use the “%p” format identifier to print the addresses. “%x” is used to print the values in hexadecimal format. printf(“%x\n”, *a); … Read more

[Solved] dynamic object creation in c++?

[ad_1] It’s not clear exactly what you are trying to do here, except perhaps learning basic c++ constructs. Here is some code to get you going. #include <iostream> #include <string> #include <map> using namespace std; class TEST { public: //Constructor – sets member string to input TEST( string input ) : _name( input ) { … Read more

[Solved] why does this code gives runtime error?

[ad_1] a is declared a an empty vector so you cannot access elements of a unless there are any elements in a. You want a.push_back(nums[i]); instead of a[k] = nums1[i]; //a is declared as empty vector so you have to push elements to it. OR you can do vector<int> a(num1.size()); instead of vector<int> a; [ad_2] … Read more

[Solved] C++ Cli code stucked [closed]

[ad_1] The code you provided does not work on any numbers. The only thing it does is construct some SQL query check its result During the SQL-query-construction, the code does not assume any “numbers” to be provided. It actually uses a variable called password_txt->Text, which suggests it’s some form of TextBox control. The code gets … Read more

[Solved] cout corrupt char* [closed]

[ad_1] You are passing a pointer to a local variable. Once your function ends, this variable is gone. If this is C++ you should use the string class. If for whatever reason you don’t, at least be const correct: const char* Worker::getName() const { return name; } 1 [ad_2] solved cout corrupt char* [closed]

[Solved] Referring to c++ enums [closed]

[ad_1] In all versions of C++, the second version (Foo::States::BAR) using scope syntax is the more conventional and will be less surprising for future maintainers of your code. Since the value is a constant, there is no need for an instance of the class, so this is similar to how static methods are most often … Read more

[Solved] How come when I try to compile my C program by making a file named for the program it creates an application for it?

[ad_1] It is normal for the compiler to generate an application! What is surprising is the location for the executable, it should have been generated in the parent directory: C:\TDM-GCC-64\> gcc Chess/chess.c Chess/init.c -o chess The explanation is interesting: You are using the Windows operating system, where the filenames are case insensitive. You instructed gcc … Read more