Hi!
I got a program which is supposed to fill SRC with 5 "ABCDEFGHIJ" in a row. Then the program is gonna pick 1 letter from SRC every ten letters and put
it in DEST, thus DEST would be filled with "AAAAA".
Unfortunately, although it's working under Turbo C++, DJGPP refuse to compile
apparently because of a multiplication at the line: "src[i*10]";
Here's my source code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void main()
{
int i;
char *src = (char *)malloc(100);
char *dest = (char *)malloc(20);
strcpy(src,"ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJ");
for (i=0; i<5; i++) dest[i] = src[i*10]; /* ERROR */
dest[5]=0;
printf("\r\nSrc says: %s \r\nDest says: %s\n", src, dest);
free(src);
free(dest);
}