Filter by Tags

Accessing array elements using pointers in c

Votes

1

1 0
This Question is asked to:

Write a program to access array elements using pointers in C. Create an integer array of 5 integers and assign them values using pointers. Then print all the values in the array using pointers.

Ravinder Singh
Posted on : Mon, Feb 19, 2018
Views : 66
Comments

Ask Question

If you want to ask question you must LogIn or SignUp
Login SignUp

Answers (1)


0

int a[5]={1,2,3,4,5}

int *ptr

int i;

ptr=&a[0];

for(i=0;i<5;i++)

{

printf("value of *ptr%d",*ptr);

printf("valueb of ptr%d",ptr);
 ptr++;

}

}

 

 

 

 

Jaspreet kaur
Wed, Feb 21, 2018
Loading...
Comments

Edit Answer

Submit
This answer will permanently deleted. Do you really want to delete this Answer ?
To Add your Answer Please
LogIn | SignUp

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp