C
chee.k.cheng
Hi,
I'm wondering if it is possible to change the starting address of a
structure element. For example, I have the following structure:
struct demo {
char digit[10];
char alpha[10];
} an;
strncpy(an.alpha, "ABCDEFGHI", 10);
strncpy(an.digit, "123456789", 10);
printf("%s\n", an->alpha) prints ABCDEFGHI.
Could anyone tell me if there is a way to change the starting address
of the alpha element, so that printf("%s\n", an->alpha) prints EFGHI?
(Start from E, instead of A)
Thank you very much.
I'm wondering if it is possible to change the starting address of a
structure element. For example, I have the following structure:
struct demo {
char digit[10];
char alpha[10];
} an;
strncpy(an.alpha, "ABCDEFGHI", 10);
strncpy(an.digit, "123456789", 10);
printf("%s\n", an->alpha) prints ABCDEFGHI.
Could anyone tell me if there is a way to change the starting address
of the alpha element, so that printf("%s\n", an->alpha) prints EFGHI?
(Start from E, instead of A)
Thank you very much.