| |

VerySource

 Forgot password?
 Register
Search
View: 888|Reply: 7

Ask a little question, wait online, urgent!

[Copy link]

2

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-31 06:00:02
| Show all posts |Read mode
private char [,] c = new char [3,3];
private void getnext ()
{
int i = 0;
int j = 0;
int a, b, c, d;
int m_i;
for (int p = 0; p <3; p ++) {
for (int q = 0; q <3; q ++)
{
if (c [p, q] == 'x') /// This error, E:\Documents and Settings\reeves\My Documents\Visual Studio Projects\Eight Digital\Form1.cs (287): Cannot apply index with [] to type "int" Expression

{
i = p; j = q;
}
}
Reply

Use magic Report

0

Threads

119

Posts

67.00

Credits

Newbie

Rank: 1

Credits
67.00

 China

Post time: 2020-3-9 08:30:02
| Show all posts
Because C is a local variable, it is an int
Reply

Use magic Report

0

Threads

119

Posts

67.00

Credits

Newbie

Rank: 1

Credits
67.00

 China

Post time: 2020-3-9 10:30:01
| Show all posts
Local variable c masks the external array c
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 India

Post time: 2020-3-9 11:00:02
| Show all posts
int a, b, c, d;
The problem is here, you have defined a c
Reply

Use magic Report

2

Threads

29

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-3-11 19:15:01
| Show all posts
agree with the 2th floor
Reply

Use magic Report

0

Threads

31

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-3-17 07:45:01
| Show all posts
if (this.c [p, q] == 'x'
Reply

Use magic Report

0

Threads

27

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-3-17 21:45:02
| Show all posts
c in int a, b, c, d; overwrites private char [,] c = new char [3,3];
Reply

Use magic Report

0

Threads

7

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-17 23:45:01
| Show all posts
Local process
private void getnext ()
in
int a, b, c, d;
covered
private char [,] c = new char [3,3];
Definition
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list