This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS: who to write OR statement



Tool/software: Code Composer Studio

CODE 
if ((v > p+6) || (v < p-6))
     {
        p= v;
     }
else
{
p = p;
}
OUTPUT
v=1      p=1
v=2      p=2
v=4      p=4
I am not understand why 'p' is every time get updated.
  • Are p and v unsigned or signed integers?

    If there are unsigned integers the calculation of p-6 for values of p <= 5 will result in a large unsigned value when could explain your observed behavior.

  • Hi Vivek,
    As I mentioned in your other thread:
    e2e.ti.com/.../2162347

    This forum is for CCS tools related questions and not general programming questions. There are many other online forums available for such questions and I recommend using any of them instead. You will likely find answers to many of your questions by searching those forums.

    Thanks
    ki