Reputation: 17
Hello I tried to get a external parameters to my main. But somehow the compiler gcc shows me weird problems I have not encountered them and did not find a solution. I would be happy if you help me understand the problems and fix them.
code-
#include <stdio.h>
#include <stdlib.h>
main(int argc, char** argv[])
{
int i;
char temp[99];
for (i=0; i < argc/2 ; i++)
{
temp = argv[i];
argv[i] = argv[argc-i-1];
argv[argc-i-1] = temp;
}
for(i = 0; i < argc ; i++)
{
printf("%s",temp[i]);
}
return(0);
}
errores
error: incompatible types in assignment
warning: assignment from incompatible pointer type
Upvotes: 0
Views: 42
Reputation: 45654
Bad prototype for main: Use int main()
, int main(int argc, char** argv)
or something compatible.
Upvotes: 2