I have two dynamically allocated arrays. c
char **a = (char**)malloc(sizeof(char*) * 5));
char **b = (char**)malloc(sizeof(char*) * 5));
for (int i = 0; i < 7, i++) {
a[i] = (char*)malloc(sizeof(char)*7);
b[i] = (char*)malloc(sizeof(char)*7);
}
If a[0]
was "hello"
and I wanted to copy a[0]
to b[0]
, would strcpy
and pointer assignment be the same thing? For example:
strcpy(b[0], a[0])
b[0] = a[0]
Would these both do the same exact thing?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…