2017-03-01 16 views
-1

私はgnu-linuxオペレーティングシステムでcファイルをコンパイルしようとしていますが、これらのコードをコンパイルしようとするとコンパイラにエラーが発生します。なぜCプログラムで迷子になった '342'エラー?

マイop.cファイルは、次のとおりです。私はこのコードをコンパイルしようと

#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; 
} 

、私はこれらのエラーを取得しています。どうすれば修正できますか?

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 

ありがとうございます。

+2

あなたがソースファイルに "スマート" 引用符を使用することはできません。 –

+0

コンパイラのエラーで最初に行うことは、スタックオーバーフローに遭遇して尋ねるのではなく、正確なエラーをGoogle検索に入力して最初のリンクを開くことです。 –

+0

これらのエラーは、ソースコード内の拡張されたASCII文字から来ていますが、これは構文では許可されていません。 –

答えて

2

文字列の正しい引用符をcで使用してください。

printf("command line argument [%d] = %s \n", i, argv[i]); 

代わりの

printf(“command line argument [%d] = %s \n”, i, argv[i]); 
関連する問題