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. int nTemp=0xe

int nTemp=0xe

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 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.
  • F Offline
    F Offline
    FlyingDancer
    wrote on last edited by
    #1

    int nTemp; nTemp=0xe; My aim is to put a hex value to a int varalbe "nTemp". As a result, the real value is 0 after those are executed. Can a int varable receive a value like 0xe directly?

    M 1 Reply Last reply
    0
    • F FlyingDancer

      int nTemp; nTemp=0xe; My aim is to put a hex value to a int varalbe "nTemp". As a result, the real value is 0 after those are executed. Can a int varable receive a value like 0xe directly?

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      An int holds a number, what base you write it in is irrelevant. These lines are all equivalent:

      int x = 15; // decimal
      int x = 0xe; // hex
      int x = 017; // octal

      --Mike-- Ericahist [updated Oct 26] | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber If my rhyme was a drug, I'd sell it by the gram.

      F 1 Reply Last reply
      0
      • M Michael Dunn

        An int holds a number, what base you write it in is irrelevant. These lines are all equivalent:

        int x = 15; // decimal
        int x = 0xe; // hex
        int x = 017; // octal

        --Mike-- Ericahist [updated Oct 26] | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber If my rhyme was a drug, I'd sell it by the gram.

        F Offline
        F Offline
        FlyingDancer
        wrote on last edited by
        #3

        Now the varable can get its right value. Maybe something is wrong with my VC6,isn't it? Thanks!

        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