chacha said:
char cSubject[256];
chat *h_ptr[8];
If I want to copy the char array pointed by h_ptr[6] to cSubject
character by character, does the code looke like the following:
strcpy(cSubject+i,*(h_ptr[6])+i);
No, it is not valid.
*(h_ptr[6]) would yield a value representing the first
char in the char array to which h_ptr[6] is pointing.
Function strcpy requires the argument represent a value
pointing to a string.
Since your description is in terms of char arrays (not strings),
you might be interested in using function memcpy. Be careful
not to extend beyond array boundries.
#include <stdio.h>
#include <string.h>
int main(void)
{
char cSubject[64];
char *h_ptr[8] = {"HelloMa ","GoodyMa ","RightMa ",
"NightMa ","SeeYaMa ","LoveuMa ",
"AintuMA ", "CantuMA "};
int i;
for(i = 0; i < 8; i++)
memcpy(cSubject+(i*8),h_ptr
,8);
puts("Contents of cSubject...");
for(i = 0; i < 64;i++) putchar(cSubject);
putchar('\n');
return 0;
}