Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Passing arguments to a function

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 09-12-2009
Members
 
Join Date: Oct 2009
Posts: 9
Passing arguments to a function
  

I would like to pass function name to another function, How to use & implement int myMethod char arg functionality passing arguments for program.

Code:
 MyObject:: myMethod (Program) (

 MyMacro (Program);

 )

Reply With Quote
  #2  
Old 09-12-2009
Member
 
Join Date: May 2008
Posts: 2,290
Re: Passing arguments to a function

When a function is called, any arguments that are provided by the caller are simply treated as expressions.You never pass a function name to another function, you actually pass function address as argument to another function. When you pass their arguments by reference, which means that the compiler passes a list of addresses pointing to the arguments to be passed.
Reply With Quote
  #3  
Old 09-12-2009
Member
 
Join Date: Jan 2009
Posts: 199
Re: Passing arguments to a function

Code:
#include <stdio.h> 
void increment(int);
 
int main(void)
{
  int cnt = 6; 
  increment(cnt);
  printf("cnt = %d\n", cnt);
 
  return(0);
}
 
void increment(int y)
{
  ++y;
  printf("y = %d\n", y);
}
Reply With Quote
  #4  
Old 09-12-2009
Member
 
Join Date: Dec 2008
Posts: 177
Re: Passing arguments to a function

Call by value :
Code:
void called_func(int, float);

main(){
      called_func(2, 2*3.5);
      exit(EXIT_SUCCESS);
}

void
called_func(int g, float arg){
      float tp;

      tp = g * arg;
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Passing arguments to a function"
Thread Thread Starter Forum Replies Last Post
Passing XSL value to javascript function Steadfast Software Development 6 13-05-2010 11:51 PM
Write a file without passing in arguments Miles Runner Software Development 5 25-02-2010 02:45 AM
Passing function pointer as argument Allan.d Software Development 3 08-12-2009 10:43 AM
Function with a variable number of arguments Chrisch Software Development 3 20-11-2009 01:03 PM
Calling a function with arguments or parameter in Powershell? ArunJ Software Development 4 18-02-2009 04:53 PM


All times are GMT +5.5. The time now is 09:23 PM.