ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General Discussion » why Array starting with Zero , and not with one

Post new topic  Reply to topic
 why Array starting with Zero , and not with one « View previous topic :: View next topic » 
Author Message
rajraj
PostPosted: Thu Mar 30, 2006 2:17 pm    Post subject: why Array starting with Zero , and not with one Reply with quote

Novice

Joined: 28 Mar 2006
Posts: 11

Hi guys

plz not to take it has a silly query , i faced this question in one of the interview.

why an array starts with zero and not with one.



any suugestions helpful


Thanks is advance.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Mar 30, 2006 2:37 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

In C, arrays start with 0.

In Java, arrays start with 1.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Mar 30, 2006 3:02 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You sure about java ?

I would have thought in java you start your array with 0.
Code:
for ( int i=0; i< myarray.size(); i++){
// do something
System.out.println(myarray[i]);
}


In VB I believe you start your array with 1. ?
Haven't touched that stuff in nearly 10 years ...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Mar 30, 2006 3:43 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Oh, wait.

Maybe I meant Scheme.

No, in Scheme arrays start with "car".

Maybe I meant with Perl.

No, in perl, arrays start with $[.

Oh yeah. It's PASCAL that has arrays starting with 1.

I knew it was some language that I've used that was Algol based but not C. I just grabbed the most recent entry from that set, rather than the first entry.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wschutz
PostPosted: Thu Mar 30, 2006 5:19 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

PL/1 arrays start with 1
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
fschofer
PostPosted: Thu Mar 30, 2006 11:04 pm    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

http://en.wikipedia.org/wiki/Array#Array_system_cross_reference_list
Back to top
View user's profile Send private message Send e-mail
vennela
PostPosted: Fri Mar 31, 2006 5:51 pm    Post subject: Re: why Array starting with Zero , and not with one Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

rajraj wrote:
Hi guys

plz not to take it has a silly query , i faced this question in one of the interview

Tell me why not to take it as silly.

IMHO, whoever interviwed you is not yet ready to interview and gauge somebody's performance.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jefflowrey
PostPosted: Fri Mar 31, 2006 6:32 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Vennela - This kind of question is usually not about the actual answer but about how the person responds.

It's like asking someone why it's bad to set DEFPSIST to yes on all queues on a queue manager.

That said, yes, it's not the best question for that sort of thing - unless you're asking it of someone fresh out of school.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wschutz
PostPosted: Fri Mar 31, 2006 7:18 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Quote:
It's like asking someone why it's bad to set DEFPSIST to yes on all queues on a queue manager.
Only a newbie would make such a silly mistake.
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
Vitor
PostPosted: Sun Apr 02, 2006 11:44 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

wschutz wrote:
Quote:
It's like asking someone why it's bad to set DEFPSIST to yes on all queues on a queue manager.
Only a newbie would make such a silly mistake.


Yes - but I've been asked a variation of that question in every MQ-related interview I've had.

Go figure...
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » why Array starting with Zero , and not with one
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.