C Online Compiler
Example: C Program to Access Array Elements Using Pointer
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C Program to Access Array Elements Using Pointer #include <stdio.h> // It's the main function of the program int main() { int count; printf("Enter the size of Array: "); scanf("%d", &count); int arr[count]; printf("\nEnter the elements of the Array:\n"); for (int i = 0; i < count; i++) { scanf("%d", &arr[i]); } printf("\nYou entered these elements:\n"); for (int i = 0; i < count; i++) { printf("%d\n", *(arr + i)); } return 0; }
5 1 2 3 4 5
Output
Clear
ADVERTISEMENTS