• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dans Array Questions

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Array Question from http://www.danchisholm.net,

int []a1; //compiles well,
int []a1,[]a2; //doesnot compile

Can anybody explain why? The reason given was " the brackets appearing before the identifier for array variable a2 are not associated with the type or the identifier. "..My question is if this is the case than why does
int []a1 compile, Is it equal to int[] a1;


Thanks for replying
Madhu
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Madhu
Its something like this
int i,int j;
Hope u got it.
 
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
int []a1,[]a2; // is illegal

int []a1,a2; // is legal, it's the same as:
int a1[],a2[]; // and also the same as:
int a1[]; int a2[];


int []a1,a2[]; // is legal, it's the same as:
int a1[]; int a2[][];
[ October 28, 2004: Message edited by: Mike Gershman ]
 
Madhu Kumar Vatts
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mike
reply
    Bookmark Topic Watch Topic
  • New Topic