I am trying to compile a C file in the GNU/Linux operating system, but when I try to compile this code, the compiler gives me some errors.
My op.c file is this:
#include <stdio.h>
int main(int argc, char *argv[]){
int i;
for (i=0; i < argc; i++){
printf(“command line argument [%d] = %s \n”, i, argv[i]);
}
return 0;
}
When I try to compile this code, I am getting these errors. How can I fix them?
op.c: In function ‘main’:
op.c:6:3: error: stray ‘\342’ in program
printf(“command line argument [%d] = %s \n”, i, argv[i]);
^
op.c:6:3: error: stray ‘\200’ in program
op.c:6:3: error: stray ‘\234’ in program
op.c:6:13: error: ‘command’ undeclared (first use in this function)
printf(“command line argument [%d] = %s \n”, i, argv[i]);
^
op.c:6:13: note: each undeclared identifier is reported only once for each function it appears in
op.c:6:21: error: expected ‘)’ before ‘line’
printf(“command line argument [%d] = %s \n”, i, argv[i]);
^
op.c:6:21: error: stray ‘\’ in program
op.c:6:21: error: stray ‘\342’ in program
op.c:6:21: error: stray ‘\200’ in program
op.c:6:21: error: stray ‘\235’ in program
Use correct the quotation mark for string representation in C.
printf("command line argument [%d] = %s \n", i, argv[i]);
Instead of
printf(“command line argument [%d] = %s \n”, i, argv[i]);