3 ms·
I don't see any mention or insinuations of arrays-are-pointers anywhere in the article. Am I missing something?
by gpderetta 4y ago
I don't see any mention or insinuations of arrays-are-pointers anywhere in the article. Am I missing something?
- coldpie 4y agoThis bit: But you might be asking. “Why can’t I just assign the source variable directly to the destination variable?” int main() { char source[] = "Hello, world!"; char* destination = source; strcpy(destination, source); // Copy the source string to the destination string printf("Source: %s\n", source); printf("Destination: %s\n", destination); return 0; } You can. It’s just that destination now becomes a char* and exists as a pointer to the source character array. If that isn’t what you want them this will almost certainly cause issues.