vendredi 21 septembre 2018

Java to C Arrays, and nested loops

I have made a simple program in java that i need to run from an arduino. Sooo i need to convert it to C. I know there is no simple way but i have no concept of C syntax. I have started to look at videos to learn-C and got started. I have most of it down, but i am lost on how to covert a code block with a similar structure to this in java: -

//VAR1 and VAR2 are int type, and AR is an int type 2d array

else if (VAR1>4){
            while (VAR1>4){
                for (int i=10;i>=0;i--){
                  if (AR1[i][0]<=VAR1){
                      VAR2=AR1[i][0]; 
                      VAR1=VAR1-VAR2;  
                      AR1[i][1]=AR1[i][1]-1; break;}
                }
      }

Aucun commentaire:

Enregistrer un commentaire