I am new to C and can't get my program to work. What is suposed to happen is at the command line I enter my program name and one argument. For example lets call my program myprog.
now after entering that it should spit out 4 (argv + 1 = 4).
so all to gether it should look like this
But it dosent do that instead it does this.
Now thats not right.
When I compile there are no errors or warnings so
I cant figure it out. here is the source. If somenone
could correct it then repost it that would be great
------ CODE ---------
int main(int argc, int argv)
if(argc == 2)
hex = dec2hex(argv);
else if(argc == 1)
printf("Error: no arguments\n");
printf("Error: too many arguments\n");
int dec2hex(int dec)
return dec + 1;