Originally Posted by
whiteflags
What about the rest of the code?
Hi Whiteflags,
Well, the garbbage in cup and tmp are transferred in to the bucket, and that messes up the flow of the code.
The goal of the code is to sort the largest string two char at the time by extracting and inserting them with the strncpy() like this...
Code:
.
.
.
if( strcmp( jar, cup ) > 0 ) {
strncpy( tmp, &bucket[m], 2 ); /* I am aware tmp is not NULL terminated */
strncpy( &bucket[m], cup, 2 ); /* The gabbage moves in and destroys the string */
strncpy( &bucket[n], tmp, 2 ); /* and more garbbage is added */
}
.
.
.
Here is the line where the variables are declared locally to the WindProc()...
char bucket[100]="", track1[]="654321", jar[100]=" ", cup[6]={""}, tmp[6]="";