Click here to Skip to main content
15,910,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: how to retrieve a HANDLE from a pointer? Pin
David Crow15-Nov-05 4:57
David Crow15-Nov-05 4:57 
AnswerRe: how to retrieve a HANDLE from a pointer? Pin
ewighell15-Nov-05 15:44
ewighell15-Nov-05 15:44 
GeneralRe: how to retrieve a HANDLE from a pointer? Pin
Steen Krogsgaard15-Nov-05 22:44
Steen Krogsgaard15-Nov-05 22:44 
AnswerRe: how to retrieve a HANDLE from a pointer? Pin
Cedric Moonen15-Nov-05 5:02
Cedric Moonen15-Nov-05 5:02 
Questiondebugging locals not matching Pin
simaneal15-Nov-05 3:35
simaneal15-Nov-05 3:35 
AnswerRe: debugging locals not matching Pin
Russell'15-Nov-05 3:50
Russell'15-Nov-05 3:50 
AnswerRe: debugging locals not matching Pin
Cedric Moonen15-Nov-05 3:51
Cedric Moonen15-Nov-05 3:51 
GeneralRe: debugging locals not matching Pin
simaneal15-Nov-05 4:22
simaneal15-Nov-05 4:22 
<br />
#include <stdlib.h><br />
#include <stdio.h><br />
#include <math.h><br />
#include <time.h><br />
#include <stddef.h><br />
#include <malloc.h><br />
<br />
#define nmax 118/* Maximum Number of pixels + 1 */<br />
#define npixels   117 /* Number of pixels in forest */<br />
#define tfactor  0.95  /* annealing temperature factor */<br />
#define xcoor 10/* maximum x coordinate */<br />
#define ycoor 117 /* maximum y coordinate */<br />
#define period  20 /* investment and management time period of interest */<br />
#define i 0.04 /* interest rate for discount factor */<br />
#define tmax 2 /*maximim number of feasible moves before stopping*/<br />
#define array_size 117<br />
<br />
<br />
<br />
int<br />
main (void)<br />
{<br />
<br />
int y;<br />
printf("starting\n");<br />
int *pix1;<br />
<br />
  if ((pix1 = (int*)malloc(array_size * sizeof(pix1))) == NULL) {<br />
    (void)printf("ERROR: Malloc failed");<br />
    (void)exit(EXIT_FAILURE);   /* or return EXIT_FAILURE; */<br />
 }<br />
<br />
int *pixm1;<br />
<br />
  if ((pixm1 = (int*)malloc(array_size * sizeof(pixm1))) == NULL) {<br />
    (void)fprintf(stderr, "ERROR: Malloc failed");<br />
    (void)exit(EXIT_FAILURE);   /* or return EXIT_FAILURE; */<br />
 } /*array for storing managment options chosen*/<br />
 for(y=0; y<ycoor; ++y)<br />
 {<br />
<br />
pix1[y]=1;<br />
pixm1[y]=1;<br />
printf("pix1= %d",pix1[y]);<br />
}<br />
//moves<br />
int ymoves;<br />
for(ymoves=0; ymoves<ycoor; ymoves++)<br />
{<br />
if(pix1[ymoves==1)<br />
{pixm1[ymoves]=0;<br />
printf("pixm1= %d", pixm1[ymoves]);<br />
}<br />
else<br />
{<br />
pixm1[ymoves]=1;<br />
}}<br />
}<br />
return;<br />
<br />


The code is a mini version of the code I am having problems with. When I watch the locals pixm1[] is supposed to switch from a 1 to 0 and it does not. The printf statement output is pixm1 =0

I do not understand why they would be different and which one reflects what the program has as pixm1[]?

simaneal
GeneralRe: debugging locals not matching Pin
Russell'15-Nov-05 4:41
Russell'15-Nov-05 4:41 
GeneralRe: debugging locals not matching Pin
simaneal15-Nov-05 5:01
simaneal15-Nov-05 5:01 
GeneralRe: debugging locals not matching Pin
Russell'15-Nov-05 5:10
Russell'15-Nov-05 5:10 
QuestionRe: debugging locals not matching Pin
David Crow15-Nov-05 5:02
David Crow15-Nov-05 5:02 
QuestionEditor-debugger setup Pin
Russell'15-Nov-05 3:26
Russell'15-Nov-05 3:26 
AnswerRe: Editor-debugger setup Pin
douglasjordan15-Nov-05 3:30
douglasjordan15-Nov-05 3:30 
GeneralRe: Editor-debugger setup Pin
Russell'15-Nov-05 4:07
Russell'15-Nov-05 4:07 
Questionshared memory Pin
Naveen15-Nov-05 2:38
Naveen15-Nov-05 2:38 
AnswerRe: shared memory Pin
Blake Miller15-Nov-05 10:25
Blake Miller15-Nov-05 10:25 
QuestionHow can I put characters directly into the keyboard buffer? Pin
reinhard_jd15-Nov-05 2:24
reinhard_jd15-Nov-05 2:24 
AnswerRe: How can I put characters directly into the keyboard buffer? Pin
douglasjordan15-Nov-05 2:42
douglasjordan15-Nov-05 2:42 
AnswerRe: How can I put characters directly into the keyboard buffer? Pin
Cedric Moonen15-Nov-05 2:50
Cedric Moonen15-Nov-05 2:50 
AnswerRe: How can I put characters directly into the keyboard buffer? Pin
kakan15-Nov-05 2:53
professionalkakan15-Nov-05 2:53 
AnswerRe: How can I put characters directly into the keyboard buffer? Pin
Bob Stanneveld15-Nov-05 5:54
Bob Stanneveld15-Nov-05 5:54 
AnswerRe: How can I put characters directly into the keyboard buffer? Pin
reinhard_jd15-Nov-05 9:22
reinhard_jd15-Nov-05 9:22 
GeneralRe: How can I put characters directly into the keyboard buffer? Pin
ThatsAlok15-Nov-05 20:59
ThatsAlok15-Nov-05 20:59 
Questionvideo capture to memory. Pin
9ine15-Nov-05 2:23
9ine15-Nov-05 2:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.