Click here to Skip to main content
15,905,148 members
Home / Discussions / C#
   

C#

 
AnswerRe: OOPS deisgn patterns and principles Pin
Keith Barrow1-Oct-13 1:01
professionalKeith Barrow1-Oct-13 1:01 
AnswerRe: OOPS deisgn patterns and principles Pin
Abhinav S1-Oct-13 1:17
Abhinav S1-Oct-13 1:17 
GeneralRe: OOPS deisgn patterns and principles Pin
Govindaraj Rangaraj1-Oct-13 4:14
Govindaraj Rangaraj1-Oct-13 4:14 
GeneralRe: OOPS deisgn patterns and principles Pin
Eddy Vluggen1-Oct-13 5:00
professionalEddy Vluggen1-Oct-13 5:00 
AnswerRe: OOPS, deisgn patterns and principles Pin
GuyThiebaut1-Oct-13 21:47
professionalGuyThiebaut1-Oct-13 21:47 
GeneralRe: OOPS, deisgn patterns and principles Pin
Keith Barrow2-Oct-13 0:32
professionalKeith Barrow2-Oct-13 0:32 
QuestionArrays Pin
Sta_Horse30-Sep-13 23:35
Sta_Horse30-Sep-13 23:35 
AnswerRe: Arrays Pin
Garth J Lancaster30-Sep-13 23:50
professionalGarth J Lancaster30-Sep-13 23:50 
What you need to understand is more fundamental than that

i & j are arbitrary - you can have anything as long as it is an integer - furthermore, you can re-use the same integer where both i and j are used in your diagram

so

C#
int myArrayCounter;


is also valid and will do (and likely better than 'i' or 'j').

What's really important, is that you realise

a) you have an array of 10 integers 'n'

b) the counter required to access the elements of the array could have any of these values 0,1,2,3,4,5,6,7,8,9

you really need to read your textbook/talk with your teacher/tutor

you can start by drawing the loop on paper


Sta_Horse wrote:
int[] n = new int[10];


means

n[0] = undefined
..
n[9] = undefined

(because the array hasnt had its values set to zero)


Sta_Horse wrote:
//initialize elements of array n
for (i = 0; i < 10; i++)
{
n[i] = i + 100;
}


So, on the first loop, i = 0, yes ? so replacing i with '0', gives n[0] = 0+100 = 100
on the second loop, i = 1 - so n[1] = 1+100 = 101
..
on the last loop, i=9, so n[9] = 9+100 = 109

n[0] = 100
n[1] = 101
... you get the picture
[n9] = 109



'g'
GeneralRe: Arrays Pin
harold aptroot1-Oct-13 1:47
harold aptroot1-Oct-13 1:47 
GeneralRe: Arrays Pin
Garth J Lancaster1-Oct-13 2:10
professionalGarth J Lancaster1-Oct-13 2:10 
AnswerRe: Arrays Pin
Pete O'Hanlon30-Sep-13 23:52
mvePete O'Hanlon30-Sep-13 23:52 
AnswerRe: Arrays Pin
OriginalGriff30-Sep-13 23:52
mveOriginalGriff30-Sep-13 23:52 
AnswerRe: Arrays Pin
V.1-Oct-13 2:22
professionalV.1-Oct-13 2:22 
QuestionHow can i do a calculation in datagridview Pin
ganesh89_babu30-Sep-13 20:40
professionalganesh89_babu30-Sep-13 20:40 
AnswerRe: How can i do a calculation in datagridview Pin
Abhinav S30-Sep-13 22:35
Abhinav S30-Sep-13 22:35 
QuestionHow to extract links from a div Pin
faiza.butt8930-Sep-13 14:53
faiza.butt8930-Sep-13 14:53 
GeneralRe: How to extract links from a div Pin
PIEBALDconsult30-Sep-13 15:02
mvePIEBALDconsult30-Sep-13 15:02 
AnswerRe: How to extract links from a div Pin
Abhinav S30-Sep-13 17:15
Abhinav S30-Sep-13 17:15 
GeneralRe: How to extract links from a div Pin
faiza.butt891-Oct-13 4:16
faiza.butt891-Oct-13 4:16 
AnswerRe: How to extract links from a div Pin
Akii Malam1-Oct-13 1:32
Akii Malam1-Oct-13 1:32 
AnswerRe: How to extract links from a div Pin
faiza.butt891-Oct-13 4:20
faiza.butt891-Oct-13 4:20 
QuestionHow to get url Pin
DollieBSP30-Sep-13 11:50
DollieBSP30-Sep-13 11:50 
AnswerRe: How to get url Pin
Ravi Bhavnani30-Sep-13 12:18
professionalRavi Bhavnani30-Sep-13 12:18 
AnswerRe: How to get url Pin
Ravi Bhavnani30-Sep-13 12:21
professionalRavi Bhavnani30-Sep-13 12:21 
GeneralRe: How to get url Pin
DollieBSP30-Sep-13 12:26
DollieBSP30-Sep-13 12:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.