×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    1

    Question Difference between array of pointes and pointer to an array

    What is the difference between array of pointers and pointer to an array please give with example

  2. #2
    Super Contributor
    Join Date
    Jun 2005
    Location
    Berlin
    Posts
    721

    Re: Difference between array of pointes and pointer to an array

    Code:
    void test()
    	{
    	int array[3];
    	array[0] = 1;
    	array[1] = 2;
    	array[2] = 3;
    
    	int* point = array; // point of an array
    	
    	
    	int* points[3];
    	
    	points[0] = &array[0];
    	points[1] = &array[1];
    	points[2] = &array[2];
    	// an array of points
    	printf("\nout: %d %d %d\n", * points[0], *points[1], *points[2]);
    	}

  3. #3
    Registered User
    Join Date
    Sep 2008
    Posts
    1

    Re: Difference between array of pointes and pointer to an array

    Hi,

    array of pointer -> each element of the array is an address to
    memory location which holds the data.

    Pointer to an array -> is base address of the array.

    Ex.
    void main()
    {
    char* test[]={"Name",Address","Ph No"};
    return;
    } //Here test is an array and every element of this array points to perticular string.

    test itself is base address which can be called as pointer to array.


    N L Swami

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •