Showing posts with label arrays and pointers in c++. Show all posts
Showing posts with label arrays and pointers in c++. Show all posts

Wednesday, February 15, 2017

Accessing Arrays and Pointers in C

In this article I would like to share with you a sample program that I wrote using C language that will ask the user to give five numbers and then our program will display the list of number being provided by our user using arrays and pointers as our data structure.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

/* Author: Mr. Jake R. Pomperada,MAED-IT */
/* Date  : February 15, 2017             */
/* Language : C                          */

#include <stdio.h>

int main()
{
    int data[5], a=0;
    printf("\n\n");
    printf("\n\tACCESS ARRAYS AND POINTERS IN C");
    printf("\n\n");
    printf("Give Elements : ");
     for (a=0; a<5; ++a) {
        scanf("%d",data+a);
        }
    printf("\n\n");
    printf("List of Values you have given ");
    printf("\n\n");
      for (a=0; a<5; ++a) {
            printf("%d\n",*(data+a));
     }
    printf("\n\n");
    printf("\n\t   END OF PROGRAM");
    printf("\n\n");
}