Sponsered Links
Categories
Sponsered Links

Accessing an array using pointers

 

This is a example of Accessing an array using pointers. In this example the array name is the pointer constant.

#include <stdio.h>

main(){
    int a[5];
    int i;
    for(i = 0; i<5; i++){
        a[i]=i;
    }

    int *b;  
   
    b=a;     
    for(i = 0; i<5; i++){
        printf("value in array %d and address is %16lu\n",*b,b);
        b=b+2;
    }
}

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved