Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Expression help

Expression help

Scheduled Pinned Locked Moved C / C++ / MFC
help
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amitmistry_petlad
    wrote on last edited by
    #1

    void main() { int x=8; x-=--x - x--; //explain me from RIGHT TO LEFT //when can operation perform on left side means x- printf("%d",x); getch(); } Thanks in advance!!

    "Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India

    N 1 Reply Last reply
    0
    • A amitmistry_petlad

      void main() { int x=8; x-=--x - x--; //explain me from RIGHT TO LEFT //when can operation perform on left side means x- printf("%d",x); getch(); } Thanks in advance!!

      "Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      Hi amit, It will follow the below steps 1) x-= (--x**)** - x--; // Decrement x by one. 2) x-= ((--x) - x**)--;// subtract x fom x. 3) (x-=--x - x)--;// Subract reult of above opertaion from X in the left side of =. 4) (x-=--x - x)--**; // Now decrement the x by one. so the results becomes 6.

      nave [OpenedFileFinder]

      A 1 Reply Last reply
      0
      • N Naveen

        Hi amit, It will follow the below steps 1) x-= (--x**)** - x--; // Decrement x by one. 2) x-= ((--x) - x**)--;// subtract x fom x. 3) (x-=--x - x)--;// Subract reult of above opertaion from X in the left side of =. 4) (x-=--x - x)--**; // Now decrement the x by one. so the results becomes 6.

        nave [OpenedFileFinder]

        A Offline
        A Offline
        amitmistry_petlad
        wrote on last edited by
        #3

        HI nave , you are absolutely right dear the answer is 6.But can you kindly explain with value . because suppose

        Naveen.R wrote:

        1. x-= (--x) - x--;

        The value of x is 7. here now the value is 7 for all x is it? means ,

        Naveen.R wrote:

        1. x-= ((--x) - x)--;// subtract x fom x.

        how can I follow the step 2 (7-7)-- will it zero or what ??? :doh: then will x will zero or the value 7 will still exist. means, 7-=(7-7)-- //my question is here whether the value of x will zero here.then what is the value of x on LEFT SIDE. because right side I got zero right. now (7-=0)-- as go with logic.... now as x=x-0 means (7=7-0)-- then after it will decrement and the result 6. I understand this way .but I thought about the x value ???? is zero or 7 at step 2. thanks nave amit - bedcollege petlad

        "Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India

        N 1 Reply Last reply
        0
        • A amitmistry_petlad

          HI nave , you are absolutely right dear the answer is 6.But can you kindly explain with value . because suppose

          Naveen.R wrote:

          1. x-= (--x) - x--;

          The value of x is 7. here now the value is 7 for all x is it? means ,

          Naveen.R wrote:

          1. x-= ((--x) - x)--;// subtract x fom x.

          how can I follow the step 2 (7-7)-- will it zero or what ??? :doh: then will x will zero or the value 7 will still exist. means, 7-=(7-7)-- //my question is here whether the value of x will zero here.then what is the value of x on LEFT SIDE. because right side I got zero right. now (7-=0)-- as go with logic.... now as x=x-0 means (7=7-0)-- then after it will decrement and the result 6. I understand this way .but I thought about the x value ???? is zero or 7 at step 2. thanks nave amit - bedcollege petlad

          "Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India

          N Offline
          N Offline
          Naveen
          wrote on last edited by
          #4

          amitmistry_petlad wrote:

          here now the value is 7 for all x is it?

          Yes.

          amitmistry_petlad wrote:

          will it zero or what ???

          yes it will be zero. But the value of X is still the same(7); that line can be broken into the following to lines. x-= 7 - 7; x--;

          nave [OpenedFileFinder]

          A 1 Reply Last reply
          0
          • N Naveen

            amitmistry_petlad wrote:

            here now the value is 7 for all x is it?

            Yes.

            amitmistry_petlad wrote:

            will it zero or what ???

            yes it will be zero. But the value of X is still the same(7); that line can be broken into the following to lines. x-= 7 - 7; x--;

            nave [OpenedFileFinder]

            A Offline
            A Offline
            amitmistry_petlad
            wrote on last edited by
            #5

            Hi nave ! I need your help for API . where can i find the API help and explanation??

            "Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India

            N 1 Reply Last reply
            0
            • A amitmistry_petlad

              Hi nave ! I need your help for API . where can i find the API help and explanation??

              "Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India

              N Offline
              N Offline
              Naveen
              wrote on last edited by
              #6

              amitmistry_petlad wrote:

              where can i find the API help and explanation??

              What do u mean?????? havent u seen the MSDN[^] yet?

              nave [OpenedFileFinder]

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups