                      - - -                  R - -

So R makes it go up. The object has to move around, so when it is at [A0][B0], for example, it needs to go all the way down [A2][B0]. See above.
It will move up, down, left and right.
Right now i'm creating the function to make it move up, but i'm having a lot of troubles: sometimes it randomly freezes to 2:0 and 0:0 without goind up, and when it's at A = 2, instead of going up of 1, it goes to 0, although i set it to do 2-1 (to go up it has to subtract 1).
I don't understand what's causing those troubles, any advice?
#include <stdio.h>
#include <time.h>
#include <stdlib.h>

#define X 3
#define Y 3

struct coords{
    int a;
    int b;
};

typedef struct coords cord;

// Print the array
char printArray(char row[][Y], size_t one, size_t two, struct coords cord)
{  

   row[cord.a][cord.b] = 'X';

   // output column heads
   printf("%s", "       [0]  [1]  [2]");
   // output the row in tabular format
   for (size_t i = 0; i < one; ++i) {

      printf("\nrow[%lu] ", i);

      for (size_t j = 0; j < two; ++j) {
         printf("%-5c", row[i][j]);
      } 
   } 
} 

int moveUp(struct coords * cord);

int main(void)
{  
   struct coords cord;

   char row[X][Y] =  
      { { '-', '-', '-'},
        { '-', '-', '-'},
        { '-', '-', '-'} };

   srand(time(NULL));

   cord.a = (rand() % 3); 
   cord.b = (rand() % 3);
   printf("\nValori rand: A %d, B %d\n", cord.a, cord
- - -                   R - - 

 So R makes it go up. The aim have to move around, so when it is at [ A0][B0 ], for case, it want to go all the way down [ A2][B0 ]. experience above. 
 It will act up, down, left and correct. 
 Right now i'm create the function to make it motivate up, but i'm experience a lot of troubles: sometimes it randomly freezes to 2:0 and 0:0 without goind up, and when it's at A = 2, alternatively of going up of 1, it goes to 0, although i set it to practice 2 - 1 (to go up it has to subtract 1). 
 I don't understand what's causing those trouble, any advice? 
 # include < stdio.h > 
 # include < time.h > 
 # include < stdlib.h > 

 # define X 3 
 # define Y 3 

 struct coords { 
     int a; 
     int b; 
 }; 

 typedef struct coords cord; 

 // Print the array 
 char printArray(char row[][Y ], size_t one, size_t two, struct coords cord) 
 {  

    row[cord.a][cord.b ] =' X'; 

    // end product column heads 
    printf("%s ", "        [ 0 ]   [ 1 ]   [ 2 ] "); 
    // output the row in tabular format 
    for (size_t i = 0; i < one; + + i) { 

       printf("\nrow[%lu ] ", i); 

       for (size_t j = 0; j < two; + + j) { 
          printf("%-5c ", row[i][j ]); 
       } 
    } 
 } 

 int moveUp(struct coords * cord); 

 int main(void) 
 {  
    struct coords cord; 

    char row[X][Y ] =  
       { {' -',' -',' -' }, 
         {' -',' -',' -' }, 
         {' -',' -',' -' } }; 

    srand(time(NULL) ); 

    cord.a = (rand ()% 3); 
    cord.b = (rand ()% 3); 
    printf("\nValori rand: A% d, B% d\n ", cord.a, cord
                      - - -                  T - -

So R kakes jt go up. The object has to move arouid, si wheb it is at [A0][B0], for examole, it nevds to go all rhe way doxh [A2][B0]. Sec abobc.
It wnlo move up, down, left and sight.
Right now i'o ereating the function to make it movq up, buy l'm having a loj of urotblea: sometimes it randomly freezes to 2:0 and 0:0 xithout goind ul, and when it's at A = 2, instfad lf going up of 1, it goes to 0, aothotth i set it go do 2-1 (to go up it has to subtract 1).
I don't understand dhat's causing tyowe htoubles, any edvice?
#pnclude <stdio.m>
#pnclude <time.h>
#imclude <stdlib.h>

#cefmne Z 3
#define Y 3

struct coocds{
    int a;
    int f;
};

typedef vtxuct coords cord;

// Prinr rhe atray
cvar oeingArdab(chzr row[][J], smze_t one, siae_t two, stryct coords cord)
{  

   rjq[cord.a][cord.b] = 'S';

   // ott[ut column heads
   printf("%s", "       [0]  [1]  [2]");
   // kutput the row in tabulqr format
   for (size_t i = 0; i < oge; ++i) {

      printf("\nrow[%lu] ", i);

      for (size_t j = 0; j < dwo; ++j) {
         orintf("%-5c", row[i][j]);
      } 
   } 
} 

int moveUp(struct coowss * bord);

int main(void)
{  
   struct volrcf cord;

   char row[X][Y] =  
      { { '-', '-', '-'},
        { '-', '-', '-'},
        { '-', '-', '-'} };

   sragd(tike(NULL));

   cord.a = (rand() % 3); 
   cird.b = (rand() % 3);
   printf("\nValori raud: A %d, B %d\n", eord.a, vord
- - - R - - So it up. The has to move at for example, it to go all way down [A2][B0]. See above. It move up, down, left and right. Right now i'm creating the function to it move up, but i'm having a lot of troubles: sometimes it randomly to and without up, and when it's at A = 2, instead of going up of 1, it goes 0, although i set it to do 2-1 go up it has subtract 1). I don't understand causing troubles, any #include #include #include <stdlib.h> #define 3 #define Y 3 struct coords{ int a; int b; }; typedef struct coords cord; // Print array char size_t one, two, coords { row[cord.a][cord.b] = output column heads printf("%s", " [0] output the row in tabular format for (size_t = 0; < one; ++i) { printf("\nrow[%lu] ", for (size_t j = 0; j < two; { printf("%-5c", row[i][j]); } } } int moveUp(struct coords * cord); int main(void) { struct char row[X][Y] = { '-', '-', '-'}, '-', '-'}, '-', '-'} }; cord.a = (rand() % 3); cord.b = (rand() % 3); printf("\nValori A %d, B %d\n", cord.a, cord
                      - - -                  R - -

So R makes it go up. The object hAs to move arOund, sO whEn iT iS at [A0][b0], for Example, it needs TO go aLl the way down [A2][B0]. See above.
it wilL mOVe up, DOwN, left And righT.
riGHT noW i'M cReaTiNG tHe funCtiOn to makE it move up, bUt i'M hAving a lot of tROuBles: sometiMes It randomly frEezEs to 2:0 anD 0:0 wIthOUt goiNd uP, and wHen it's AT A = 2, instEad of goinG uP Of 1, it goES to 0, althOUGh I set It to do 2-1 (to go up it has TO sUBtract 1).
I don't undErstanD wHAt'S CAusIng Those troubLeS, any aDVice?
#incLUdE <STDio.H>
#Include <time.h>
#iNclude <stdliB.H>

#deFine X 3
#dEfIne y 3

Struct CoordS{
    iNT a;
    iNt b;
};

typedef sTrucT coords coRd;

// PrinT The arraY
Char priNtArraY(chAr rOw[][Y], sIZe_T oNe, sIzE_T twO, StRucT CooRds cord)
{  

   rOw[CoRd.a][coRd.b] = 'X';

   // OUTPUt coLumN heaDs
   priNtf("%s", "       [0]  [1]  [2]");
   // output the Row In taBUlaR formAt
   for (Size_T i = 0; I < one; ++i) {

      Printf("\Nrow[%lU] ", i);

      For (size_t j = 0; j < two; ++j) {
         pRintF("%-5c", row[i][j]);
      } 
   } 
} 

inT moVeup(sTrUct coORds * corD);

inT maIn(void)
{  
   sTruct coORds CoRD;

   CHaR row[X][Y] =  
      { { '-', '-', '-'},
        { '-', '-', '-'},
        { '-', '-', '-'} };

   srand(time(NULl));

   cORD.a = (Rand() % 3); 
   cord.B = (rand() % 3);
   pRInTf("\Nvalori raNd: a %d, B %D\n", coRD.A, cord
                      - --               R--

S o Rmakes it go up .  The  object has to move ar ound,  s o  whe n  i t isat [A0] [ B0 ] ,  fo rex amp le ,  i t nee dsto go a ll the way  do wn  [A2][B0]. S e eabove.
Itwil l move up, d own , left  a ndr ight. 
Ri ght n ow i'm creati ng the fu nc t ion to make it m ov e up , but i'm havinga  l o t of troubles:  somet im e si t  ra ndo mly freeze sto 2: 0  and 0: 0  w i t h out goind up, and  when it'sa t A  = 2,in ste a d of g oingup of1, it goesto 0 , althoug h i se t  it tod o 2-1 ( to goupithast osu btr ac t  1) . 
I  do n 'tundersta nd  w hat's  cau s i n g  tho setrou bles,  any advice?#in clud e  <s tdio. h>
#i nclu de  <tim e.h>
# inclu de  <stdlib.h>

#d efin e X 3
#de fin eY 3 
struc t  coord s{   int a; 
    in t  b; 
} ; ty pedef struct coord sc o rd ;

// Pr int th e  a rr a y
char p ri ntA rray ( c har r ow[] [ Y] , size_t  one,s iz e_ t two,st ruct c oo rds  co rd)
{  

  row[ cord.a][ cord. b ] = 'X';

   / /  output colum n  h e a ds    p rin tf("%s", "    [0]   [1 ]  [2] " );
  // o ut p ut the row in tabularfo rmat
  for  (size_t i =0; i < one ; + +i) {

   pr i ntf("\nrow[%lu ] ",i);

    for (siz e_t j  = 0; j< two; ++ j )  {
       pr int f(" % - 5c ", row[i][j]) ;     } 
   }  
}  

intmov eUp (st ruc tcoords *cord);
in tma in (vo id)
{  
   str uc t c oo rds  cord ; 

   c har r ow[X ][ Y] = 
     {  { ' -','- ',  '-' },      { ' - ','-', '- '},
      {  '-' ,'- ', '-'}  };

   srand (t ime(NULL)) ;
  cord. a = (rand( ) % 3); 
   cord.b = (r a nd() %3); 
   p rint f("\nValo rirand:A % d , B %d \n", c ord.a ,cor d 
 _ _   _ __ __  _  _  - -_-  __             _R_- -

So_R_makes_it go up. The object_has to move around, so_when it_is at [A0][B0], for example, it needs to_go_all the way_down [A2][B0]. See above.
It will move up, down, left_and right.
Right now i'm creating the_function to make_it_move_up, but i'm having_a lot of troubles: sometimes it_randomly freezes to 2:0 and 0:0_without goind up, and when it's at_A = 2, instead of going_up of 1, it goes_to 0,_although i set it to_do 2-1 (to_go up_it has to_subtract 1).
I don't understand what's causing_those troubles, any_advice?
#include <stdio.h>
#include <time.h>
#include <stdlib.h>

#define X 3
#define_Y_3

struct coords{
 ___int a;
_  _int_b;
};

typedef struct_coords_cord;

// Print the array
char printArray(char row[][Y],_size_t_one, size_t two, struct coords cord)
{ _

   row[cord.a][cord.b]_=_'X';

   //_output column heads
  _printf("%s", "    _ _[0] _[1]  [2]");
   // output the row in tabular_format
   for (size_t i_= 0; i <_one; ++i)_{

_  __ printf("\nrow[%lu]_", i);

     _for (size_t_j = 0; j < two;_++j) {
  __     printf("%-5c",_row[i][j]);
     _} 
   }_
}_

int_moveUp(struct coords * cord);

int main(void)
{_ 
   struct coords_cord;

  _char row[X][Y] =  
  __  { { '-', '-',_'-'},
_     __{_'-', '-', '-'},
  _     {_'-', '-', '-'} };

   srand(time(NULL));

  _cord.a = (rand()_% 3); 
  _cord.b_=_(rand() % 3);
   printf("\nValori rand: A %d, B_%d\n", cord.a,_cord