174 Topics

Member Avatar for
Member Avatar for Joaquim_5

with CreateDIBSection() we create an array of DIB's pixels .. but it's a copy and not a pointer :( when i change 1 pixel or draw a rectangle, i must re-create the DIB's and then draw the result. Private bmpPtr() As Long ReDim bmpPtr(ImageWidth * ImageHeight - 1) hBitmap = …

1
38
Member Avatar for kouty

I have a function pointer to calculate addition, substraction, etc for 2 inputed arguments and 1 inputed operation. It works fine when the code return the indexed function pointer (with the inputed index) function pointer with both inputed arguments. but when I initialize a variable with as value this indexed …

Member Avatar for ravss
1
591
Member Avatar for catastrophe2

the following short program asks user to enter # of hospital rooms (between 1-5), and asks for number of flowers, which cannot be a negative number. Then, it picks based on how many rooms the price from the `hospitalRoomsPrices_Array[5]`, and it also displays the total flowers multiplied by $2.50 each. …

Member Avatar for Reverend Jim
0
301
Member Avatar for nitin1

Hi, I am facing an issue in string to const char pointer conversion. I am doing stuff in the fun() but here i am just giving my example. Here it the code: // Helper function string fun() { string abc = "Daniweb"; // print here #1 return abc; } // …

Member Avatar for AssertNull
0
3K
Member Avatar for rvndrdahiya

I declared two different char * and initialised them to the same string. but i thought they would be pointing to the different addresses , but they pointed to the same addresses.. How come this happens? char* arr = "abcdefgh"; char* brr = "abcdefgh"; cout<<arr<<endl; cout<<brr<<endl; the values printed out …

Member Avatar for rvndrdahiya
0
274
Member Avatar for kent.johnstone_1

In the following code I'm trying to make "SRAM", "FRAM", "EEPROM", and "FLASH" constants, MEM_TYPE an 8-bit variable that can be changed by other programs. The pointer should be pointing to MEM_TYPE. I'm getting a error under uint8_t (defined as BYTE elsewhere in an included file), "*", *and enum which …

Member Avatar for Nutster
0
239
Member Avatar for krieg

Okay, so this is my current code: #include <stdlib.h> #include <stdio.h> #include <stdint.h> struct Display { int width; int height; char **array; }; struct Display *display_create(int width, int height) { struct Display *display = (struct Display *) malloc(sizeof(struct Display)); display->width = width; display->height = height; display->array = (char **) malloc(sizeof(char) …

Member Avatar for krieg
0
346
Member Avatar for masterinex

why this code not work ?? # include <stdio.h> void get_values(float *r, float *v); float do_calculations(float resistance, float voltage ) ; void display_answer(float current); main() { float resistor; float volts; float current; //explain_program(); get_values(*r, *v); current = do_calculations(resistor, volts); display_answer(current); } void explain_program() { printf("This program calculates the current in …

Member Avatar for rubberman
0
633
Member Avatar for nekoleon64

My Name is Leonard E. Norwood Jr. I'm Undergraduate student from Norfolk State University in Norfolk Virginia. Getting down to the point, my program is supposed to print out a list of pre-set numbers in reversal. I used pointers for this, however, something went wrong so I'm trying my best …

Member Avatar for iamthwee
0
361
Member Avatar for samson.dadson.3

#include<iostream> using namespace std; int main(){ int fish =6; int * fishp = &fish; cout<<fishp<<endl; return 0;} this runs ok, but i get the same memory address when i cout either fishp or &fishp. how is it possible for a pointer to have the same address as the address it's …

Member Avatar for samson.dadson.3
0
296
Member Avatar for ubhart

I am implementing Priority QUE as a doubly linked list. My structs: typedef int kintyr; typedef struct qElem { struct qElem *prv; kintyr *dat; int *priority; }qElem; typedef struct que { qElem *fr,*bk; int cnt; }que; And this is my functions to create empty PQ, and to insert elements: que …

Member Avatar for ubhart
0
398
Member Avatar for cppgangster

Hi there, I am having a problem of passing arrays to functions, here is my code: void zeroMatrix(float **arr); void main() { float e[2][2]; zeroMatrix(e); } void zeroMatrix(float** arr) { int i,j; for (i=0;i<2;i++) { for(j=0;j<2;j++) { *( *(arr +i)+j) =0; } } } The problem is I want to …

Member Avatar for David W
0
332
Member Avatar for kent.johnstone_1

I need some pointers with pointers. What is the difference between a variable preceded by an "*" and an "&"? Some of my sample code uses one and some the other. I'm getting compiler errors trying both saying the variable is not defined. First use this function.

Member Avatar for kent.johnstone_1
0
414
Member Avatar for prettyknitty

Hello, I was wondering what a second pair of eyes (or several) might have for opinions on this code? This program is supposed to store a user generated array, and functions which tell the highest, lowest, etc. Mainly, I need help with the "set cell" part, which is supposed to …

Member Avatar for NathanOliver
0
215
Member Avatar for Sonu_2

How can I create an array of pointer using **P and point it to NULL? Let's say I have coded as below . struct s { float a ; char x ; } ; s **p ; p = new ( s * [10] ) ; Now I want to …

Member Avatar for richieking
0
329
Member Avatar for tanatos.daniel

I have an abstract class CArticle and two derived classes CBook and CMagazine. I also have a class CLibrary where i want to add articles. Its members are an int variable to count the articles and a double pointer of CArticle. I have the following main function: int main() { …

Member Avatar for tanatos.daniel
0
445
Member Avatar for eldiablo1121

Hello, First of all I want to thank all the help with my posts. I have a program where I have to convert a phrase from lower case to upper case, but I cannot use any of the toupper() isupper() functions and vice versa. I think I almost got it, …

Member Avatar for eldiablo1121
0
2K
Member Avatar for eldiablo1121

Hello, I have a program assignment that I have no idea what it's asking for honestly. I've tried to read all I can about it, but I do not understand. I tried my hand at some code, but it's only returning the address of course. Here is my attempted code: …

Member Avatar for eldiablo1121
0
416
Member Avatar for prakhs

I have an array of elements. Think each of the element as competitors, and a tournament is going to rank them. The output of the program is showing elements at each level. Here's the code: #include <stdio.h> #include <stdlib.h> bool isPowerOfTwo (int x) { /* First x in the below …

Member Avatar for iamthwee
0
238
Member Avatar for dmikawa

Need help writing a program for class. Here were the posted instructions: Step 1: The program should have a FUNCTION that displays a screen that shows which seats are available and which are taken. Seats that are taken should be represented by a # symbol and seats that are available …

Member Avatar for tinstaafl
0
682
Member Avatar for bazingatheory

hi i am really new to this and can't see why i can't get my code to work, it is probily really silly but help would be appreciated. i am trying to get the user to enter the number of competators of a 4 lap race so that it can …

Member Avatar for Moschops
0
328
Member Avatar for nifhail

I REALLY NEED HELP WITH THIS QUSTION AND I ONLY HAVE 48 HOURS TO COMPLETE IT.. I DONT EXPECT ANY OF YOU TO DO IT FOR ME.. BUT I REALLY NEED SOMEONE WHO WOULD TEACH ME.. EMAIL : nifhail_torres@yahoo.co.uk As everyone knows that Malaysia is going to have the 13th …

Member Avatar for NathanOliver
0
709
Member Avatar for adison.afonso

I have this Singleton class called ZombieLand that is supposed to represent a 2D array. This 2D array is getting constantly updated and populated by different instances of my MachineState struct, which contain x and y coordinates to help me navigate through the 2D array. #pragma once #include "singleton.h" #include …

Member Avatar for Moschops
0
235
Member Avatar for saurabh.mehta.33234

I have the following code.According to this the values of pointers p[0] and p[1] remains unchanged since the swap is made to local variables in swap function.Now my doubt is how can I swap the pointers p[0] and p[1] inside the function swap?? #include<stdio.h> int main() { char *p[2]={"hello","good morning"}; …

Member Avatar for Schol-R-LEA
-1
196
Member Avatar for Melly3

Hi, I'm working on classes with pointers. I do have a main function that calls this. This program compiles. But the input from the user isn't getting passed to the other functions. The user_input function should take the response and pass it to the create_posting then it is outputted to …

Member Avatar for RonalBertogi
1
223
Member Avatar for coolbeanbob

Hello, I am working on an assignment. I am given the code below. I am trying to figure out what the line directly below is doing. Is this a functor? I am getting a compiler error saying the compiler expects a ';' before the '*'. I've searched for functor examples, …

Member Avatar for rubberman
0
189
Member Avatar for wschamps42

So what would be the size of this array in bytes if on a 32 bit machine: double *arr[4] ;

Member Avatar for rubberman
1
262
Member Avatar for isrinc

`Inline Code Example Here`I am using a pair of pthreads that call a pair of functions for ping-pong dma data transfer that are used in a loop for data transfer from an acquisition board. For a large # of waveforms, I ultimately run out of PC memory and the program …

Member Avatar for Ancient Dragon
0
264
Member Avatar for FelineHazard

Hi guys What's the default pointer value in c++? Can I count on the compiler to set an uninitialized pointer to NULL? Is it compiler dependant? What's the "consensus"? Thanks! -FH

Member Avatar for FelineHazard
0
686
Member Avatar for raul8

Hi, I've not worked in C, C++ from like 5-6 years. But now I got to do a very small change (explained below). I tried reading tutorials but only got confused. Below I've struct containing 2 attributes. I need to create its refrence and pass values to these 2 attributtes. …

Member Avatar for rajenpandit
0
235

The End.