title: C Two-Dimensional Array
body: <p>I'm going to ask something about my code provided below... My question is in the line where there's a comment <code>/*This line*/</code>. I used variable y and x: y for the HEIGHT and x for the WIDTH. The very first time I run the program, the code was <code>scanf("%d,%d", &amp;y, &amp;x);</code> but unfortunately, the program was not running properly. But when I modified the code with this <code>scanf("%d,%d", &amp;x, &amp;y);</code>, then, I was able to run the program in turn. I can't understand how it happened, since I had set the y as HEIGHT and x as WIDTH?</p>
  
  <pre><code>   File   Edit   Run   Compile   Project   Options   Debug   Break/watch
  ╒════════════════════════════════════ Edit ════════════════════════════════════╕
  │      Line 1     Col 43  Insert Indent Tab Fill Unindent * C:NONAME.C         │
  │#define HEIGHT 5                                                              │
  │#define WIDTH 10                                                              │
  │                                                                              │
  │char enemy[HEIGHT][WIDTH]=                                                    │
  │        { {0,0,0,0,0,0,0,0,0,0},                                              │
  │          {0,1,1,0,0,1,0,0,0,0},                                              │
  │          {0,0,0,1,0,1,0,1,1,0},                                              │
  │          {0,0,0,0,0,0,0,0,1,1},                                              │
  │          {0,0,1,1,0,1,0,0,0,1} };                                            │
  │                                                                              │
  │main()                                                                        │
  │{                                                                             │
  │        char friend[HEIGHT][WIDTH];                                           │
  │        int x,y;                                                              │
  │                                                                              │
  │        clrscr();                                                             │
  │                                                                              │
  │        for(y=0; y&lt;HEIGHT; y++)                                               |
  |               for(x=0; x&lt;WIDTH; x++)                                         |
  |                      friend[y][x]='.';                                       |
  |                                                                              |
  |        while(x &gt;= 0)                                                         |
  |        {                                                                     |
  |                for(y=0; y&lt;HEIGHT; y++)                                       |
  |                {                                                             |
  |                        for(x=0; x&lt;WIDTH; x++)                                |
  |                                printf("%c", friend[y][x]);                   |
  |                        printf("\n");                                         |
  |                }                                                             |
  |                                                                              |
  |                printf("Coordinates: ");                                      |
  |                scanf("%d,%d", &amp;x, &amp;y);                       /*This line*/   |
  |                                                                              |
  |                if(enemy[y][x] == 1)                                          |
  |                        friend[y][x]="\xDB";                                  |
  |               else                                                           |
  |                        friend[y][x]="\xB0";                                  | 
  |        }                                                                     |
  |}                                                                             │
  ├─────────────────────────────────── Watch ────────────────────────────────────┤
  │                                                                              │
  └──────────────────────────────────────────────────────────────────────────────┘
   F1-Help  F5-Zoom  F6-Switch  F7-Trace  F8-Step  F9-Make  F10-Menu   NUM
  </code></pre>