C doubt regarding array of pointers please explain

Posted by ramya on Stack Overflow See other posts from Stack Overflow or by ramya
Published on 2010-04-17T06:24:59Z Indexed on 2010/04/17 6:33 UTC
Read the original article Hit count: 205

Filed under:

why do we use static with array of pointers?what is the relation betwwen static and array of pointers??plz help.... for eg:

main()
{
  int a[]={1,2,3};
  int *p[]={a,a+1,a+2}; 
  ......
} 

this code shows illegal initialization.why?whereas the following code works

main()
{
   static int a[]={1,2,3};
   static int *p[]={a,a+1,a+2}; 
  ......
}

please do clear my doubt as soon as possible....

© Stack Overflow or respective owner

Related posts about c