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. help me~ for use..... #define macro ## #@ #

help me~ for use..... #define macro ## #@ #

Scheduled Pinned Locked Moved C / C++ / MFC
help
2 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.
  • D Offline
    D Offline
    dsyoon ds
    wrote on last edited by
    #1

    #define FUNC_1(x) (x+1) #define FUNC_2(x) (x+2) #define FUNC_3(x) (x+3) #define FUNC_4(x) (x+4) #define FUNC_N(n, x) (FUNC_##n(x)) ---------------------------------------- int result1 = FUNC_N(1, 100);//OK but i want to below: int a = 1; int result2 = FUNC_N(a, 100);//NG please help ~

    D 1 Reply Last reply
    0
    • D dsyoon ds

      #define FUNC_1(x) (x+1) #define FUNC_2(x) (x+2) #define FUNC_3(x) (x+3) #define FUNC_4(x) (x+4) #define FUNC_N(n, x) (FUNC_##n(x)) ---------------------------------------- int result1 = FUNC_N(1, 100);//OK but i want to below: int a = 1; int result2 = FUNC_N(a, 100);//NG please help ~

      D Offline
      D Offline
      Daniel Pfeffer
      wrote on last edited by
      #2

      Please don't cross-post. See [my answer](https://www.codeproject.com/Messages/5541483/Re-help-me-for-use-sharpdefine-macro-sharpsharp-sh.aspx) in Algorithms.

      Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

      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