> From: Lawrence Lile [mailto:llile@toastmaster.com] ... > > This works: > > DO{ > hours++; > pString = &Array[0]; > printf( MakeString,"Time is: %2U", hours); > home_lcd(); > puts(array); > delay_ms(1000); > }WHILE(TRUE); Wow! What is MakeString? Is it a pointer to character? Does your printf() work like sprintf()? how does array get any values in it? Does MakeString == array? > > But this don't > > DO{ > hours++; > pString = &Array[0]; > printf( MakeString,"Time is: %2U", hours); > strcpy(string1, " horay!"); > // trying to use STRCPY.. STRCAT to construct a string > strcat(array, string1); > // Causes the Dreaded Memory Problem after a couple rounds > home_lcd(); > puts(array); > delay_ms(1000); > }WHILE(TRUE); The strcat() statement causes the contents of string1 to be appended to the string which starts at the address pointed to by array. I would expect examining array after each pass, you would see it pointing to data that looked like this: " horay!" " horay! horay!" " horay! horay! horay!" " horay! horay! horay! horay!" ... At some point it's bound to run over some important piece of data. Based on my guess at what you're trying to do, I think you would want code that looks like this: do { hours++; /* Note: here array is the same as &array[0] */ printf(array, "Time is: %2U", (hours % 100)); strcpy(string1, " horay!"); // trying to use STRCPY.. STRCAT to construct a string strcat(array, string1); home_lcd(); puts(array); delay_ms(1000); /* if the strange printf concatenates, with array, you need to make it a null string again */ array[0] = '\0'; } while(TRUE); If you're not trying to get practice with strcat and strcpy, this is a better solution: do { hours++; /* Note: here array is the same as &array[0] */ printf(array, "Time is: %2U horay!", (hours % 100)); home_lcd(); puts(array); delay_ms(1000); /* if the strange printf concatenates, with array, you need to make it a null string again */ array[0] = '\0'; } while(TRUE); -Mike -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu