You might notice that the above code doesn't compile, this is the error:
cannot convert parameter 2 from 'BYTE [2][4]' to 'BYTE *' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Even after some search I couldn't really find an answer to my problem, how do I pass the const BYTE array which I declared above in the function as a parameter (or what structure do I need to set for the function as a parameter)?
I have some trouble with DLL. I created a dll with function
double square(const double * args)
and then in my application defines
typedef double (*MyFunct)(const double *args);
I use LoadLibrary and GetProcAddress to get the function address and cast it to MyFunct. Everything works fine except that when I pass a double *, for example 0x08800350, to the DLL function, the argument becomes totally something else, for example, 0x0aa00460.
I have no clue what happens to the argument value.
I am trying to make a automated menu. It shows there are no syntax errors but when compiled it says cannot convert choice from type into to menuItemType. I am not sure what I did wrong. Here is the code
I'm quite new to C and these days I have been playing around with a linked list. I managed to make a working version using pointers, ad only for the sake of learning I was trying to do the same thing just passing the "Object reference" Here is the method that apparently doesn't work..
Code:
struct Node addNode(struct Node head){ int value; struct Node *n; printf("Please enter the value "); scanf("%d", &value);
[Code]...
when I return the function i have something like: head=addNode(head)
Unfortunately it does not work the way I aspect. I suppose that there is something I have left out..
Code: like n->next=&head // passing the address of the head at the next pointer of the struct head =*n //copy the values of the new node to the old head..
There must be something wrong with this line.. return head; What have I done wrong?
I have some code here where I try to declare a struct then pass it as a parameter into a function to do something to it:
Code: struct _user { char * initial[3]; int pos; } user; int initial_add (struct user * initial_list, int initials, char * buffer) {
[Code] ...
I get the error : server2.c:15: warning: "struct user" declared inside parameter list server2.c:15: warning: its scope is only this definition or declaration, which is probably not what you want
I want to pass some parameters to a dialog. I am trying to pass a struct as LPARAM in CreateDialogParam. How to access this structure from ONOK for example?
I built a program that finds the average amount of days missed per employee. I am now attempting to modify my program to pass values by reference rather than passing by value. I created 3 functions: int numOfEmployees(); int numOfDays(int); double avgDays(int, int);
in the prototype I use the ampersand sign int numOfDays(int&); in the actual function I use numOfDays(int& employees)
I am just not able to get the call to the function to work the program will crash when I modify it with the ampersand signs.This is the original code I am trying to modify:
#include <iostream> using namespace std; int numOfEmployees(); //Prototype for numOfEmployees int numOfDays(int); //Prototype for numOfDays double avgDays(int, int); //Prototype for avgDays
I built a program that finds the average amount of days missed per employee. I am now attempting to modify my program to pass values by reference rather than passing by value. I created 3 functions:
int numOfEmployees(); int numOfDays(int); double avgDays(int, int);
in the prototype I use the ampersand sign int numOfDays(int&); in the actual function I use numOfDays(int& employees)
I am just not able to get the call to the function to work the program will crash when I modify it with the ampersand signs. I know I have to re-work my program, but I am having a hard time understanding how.
This is the original code I am trying to modify:
#include <iostream> using namespace std; int numOfEmployees(); //Prototype for numOfEmployees int numOfDays(int); //Prototype for numOfDays double avgDays(int, int); //Prototype for avgDays
I am trying to extract unsigned values from an input stream. I expect the extraction to fail when an invalid character is extracted. It fails correctly when I try to extract an unsigned int from "abc", but when I try to extract an unsigned in from "-1", the extraction succeeds, and the max unsigned int value is extracted (as if -1 were cast to unsigned int). I would expect the '-' to cause the extraction of an unsigned value to fail.
The code I am using is below.
#include <iostream> #include <sstream> #include <string> #include <limits> int main() { unsigned int value = 8; std::string negString = "-1";
[Code]...
Is this standard behavior for an istream extractor?
I am trying this in both Linux (gcc 4.4.3) and in windows with Code::Blocks (whaterver came with CB 13.12, apparently gcc 4.7.1)
Well I know how to pass values between forms using get and set properties. But the problem with it is everytime I want to pass values from form2 to form1 it doesn't appear. To make it appear I have to type form1.Show(); which open form1 a second time and then show the value. Is there any way I could make it appear without using form1.Show();?
I basically need to take line1, line2, and line3 and return them to the reverseString function. Also, I am not allowed to do anything like make my own classes. I have to stick to the basics and no higher level programming techniques since we have not learned them yet.
This code is for fun, and have it doing a lot of what I want it to, just not all. I want random generated to write to a txt file. I tried to use an array but that failed. I wanted to use an array because i am only passing one value. Which makes sense since the random generated function is an int.
I made the fprintf as a comment but hopefully soon it will be able to send the values to the txt file. After that I will tackle the function.
Code:
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define HIGH 49 #define LOW 1 int random_generated()
I'm trying to print values from a vector of a struct and I don't really know how to do that. Here is a simple code that I have for now to test how to add data to the vector then attempt to print it out.
#include <iostream> #include <vector> #include <string> #include <deque> #include <fstream> using namespace std; struct Employee//employee data
As you can see I am trying to re-crate the output from the first loop in my second loop, however it is with little success. The second loop's first run re-crates the last output of the first loop and if I use FileStructPointer++ or -- the output goes broke.
See attached for how it looks in the console window.
I'm trying to pass 2 arrays into a void funtion, and return values to one function.
this is the the program I'm working with, after I'm done I have to split it into 3 files, a header, a main, and a separate cpp file for the functions to live in.
#include <iostream> using namespace std; void processArrary(int numberCount[], int Numbers[], int intnumberSize, int numberCountSize); int main() { int Scores[26] = {76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189}; int numberCount[8] = { 0 };
[code]...
The goal of this program is to separate and count the groups of numbers then output the amount of numbers in each group. Near as I can tell, everthing should work, but I'm getting all zeros to be displayed in each group.
I've been given an assignment with the below questions.
1. What is the difference between pass by reference & pass by pointers?
2. What is the use of the initialization list in the constructor?
3. What is meant by a reference & its advantage?
4. Class has a reference, pointer and a const. Is it possible to write the copy constructor & assignment operator overloading funciton? how? ( Since reference is there, I'm not sure on how to write for it)
5. Example for a variable decleration and definition? (I know for function but for variable don kw how)
6. static and const static what is the difference??