An array of pointers is an array where each element is a pointer.
- Useful for storing addresses of strings or arrays.
- You can declare an array of pointers and assign pointers to strings or other data.
- This is commonly used for storing multiple strings.
Example:
#include <stdio.h>
int main() {
// Array of pointers to strings
char *colors[] = {"Red", "Green", "Blue", "Yellow"};
for(int i = 0; i < 4; i++) {
printf("Color %d: %s\n", i+1, colors[i]);
}
return 0;
}