
October 8th, 2012, 07:43 AM
|
|
Contributing User
|
|
Join Date: Oct 2012
Posts: 71
Time spent in forums: 1 Day 7 h 39 m 39 sec
Reputation Power: 1
|
|
Quote: | Originally Posted by clearner007 I have two function 'foo' and 'bar' needs to be executed . Both have same definition but different implementation. I have program called 'test' which executes the function 'foo' or 'bar' based on the input argument. Implement your solution in C
For example,
$ run test bar - runs the 'bar' function
$ run test foo - runs the 'foo' function
this is the question
I cant understand the question.. plz explain & giv a program for the above question |
Just check the command line arguments and then make a decision on what's passed. i.e.
Code:
if ( !strcmp(argv[1], "foo") )
{
/*call foo*/
}
...
|