manipulating arg in the: function(char* arg); without returning it[C,freebsd7.1,gcc]
As the title of the topic is not so clear, now here i can clear my problem...
I have a program source code, main.c . In which i m intending to do following thing with out changing the source code...
----------------------------------------------------------------------------------------------------
Code:
#include <stdio.h>
int main(int argc,char **argv)
{
char* backup;
char* arg = argv && argc > 0 ? argv[1] : NULL;
backup=arg;
foo(arg);
if (strcmp(arg, backup) != 0)
{
printf("Yeah! u success; as u have manipulated arg");
}
else
printf("You Failed!; no change in arg; arg and backup both are same");
exit(0);
}
void foo(char *arg)
{
arg="what can i do in it :( ??????? " ;
}
-----------------------------------------------------------------------------------------------------
I am beginner in C, I want to do some thing in this funtion so i would be able to change the arg, without returning arg from this method, as i m not supposed to change in the main method, i can only do things in foo function.
waiting for ur suggestions..
thanks for your concentration.
I m using freebsd7.1 and compiler is gcc.