logo

Courses with this lesson

The address of an array in C

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char* argv[]) { char str[20] = "Example string"; printf("Value: %s\n", &str[0]); printf("Address: %p\n", str); printf("Address: %p\n", &str[0]); printf("Address: %p\n", &str[0] + 1); // &str[0] is a char* printf("Address: %p\n", &str + 1); // &str is a char*[16] printf("Size of array: %llu\n", sizeof(str)); return 0; }