Click here to Skip to main content
14,177,174 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
is it possible to create an array whose each element is a pointer in c language.
if it is possible then how to do that...
Posted
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

Yes, it is possible and you should already know that, because the entry point of every C program, that is the main function, can have the following signature
int main(int argc, char * argv[])
   
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

   
Comments
nv3 17-Oct-13 8:37am
   
Funny thing -- didn't know that one yet.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

   
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

yes it is possible to create an array whose each element is a pointer.

if you have used linked list and character pointers than you might be familiar with the fact
that they makes use of the pointer variables to append the elements


char *ch = "ASDFGH";


here ch will hold the initial position of the string but when you print the whole string
using printf("%s",ch); you will get the complete string.

and suppose you have taken an char *Array[20] it will take 20 elements and each of the element would a pointer .

int main()
{
 char *arr[20];
 char ch = 0;

   while(ch<20)
   {
    arr[ch] = &ch; 
    ch++; 
    printf("%d\n",*arr[ch]);
   }
  getch();
}


[edit]Code block added[/edit]
   
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

best option you can search on google get immediately solutions .
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.190526.1 | Last Updated 17 Oct 2013
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100