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. return program

return program

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

    i want to know here that when i write a function like this int add (int a,int b) { int sum=0; sum=a+b; return sum; } i return sum but return sum to where.... that what i hope to know thank's for all To Be Or Not To Be (KARFER)

    H M 2 Replies Last reply
    0
    • K KARFER

      i want to know here that when i write a function like this int add (int a,int b) { int sum=0; sum=a+b; return sum; } i return sum but return sum to where.... that what i hope to know thank's for all To Be Or Not To Be (KARFER)

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      When you need to post a code you can use of

      pre

      and dont need to post again.;)


      WhiteSky


      1 Reply Last reply
      0
      • K KARFER

        i want to know here that when i write a function like this int add (int a,int b) { int sum=0; sum=a+b; return sum; } i return sum but return sum to where.... that what i hope to know thank's for all To Be Or Not To Be (KARFER)

        M Offline
        M Offline
        Moonis Ahmed
        wrote on last edited by
        #3

        since you are returning an integer data type, you can call the function to an integer like: int s; s=add(2,3); where you pass 2 and 3 as integers and get 5 as the sum which is stored in the variable s. The add function can be called from any other function or main method. hope that helps.

        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