main(int c,char **args){
int i
char input[100];
bzero(input,100);
for(i=1;i<c;i++)
{
input=strcat(input,args);
input=strcat(input," ");
}
}
i have included the string.h header file….
I want the input i enter in the command line to be stored in the input array.
could anyone please correct my code..
Thank you.
You have two fatal problems – the first is that you need to access the
args[i]member of the argument array, and the second is that you can’t assign directly to theinputvariable, since it’s an array.In addition:
inputarray;main();Here’s what it looks like with those issues fixed:
(I also included the
puts()line so that you can see what ends up ininput).