"Expected function body after function declarator " compiled using GCC in Terminal

Saurabh Saini Source

I am trying to compile following program using GCC in terminal

//  fileCopy.c
//  Created by Saurabh Saini on 14/02/18.
#include <stdio.h>

int main(){

int c;
c = getchar();

    c = getchar();
return 0;

getting the following error enter image description here

I need to understand what is



answered 5 days ago cse #1

<U+0010> is here indicating that: Unicode character with value 0x10(hexadecimal; 16 in decimal).

<U+0010> is called DATA LINK ESCAPE(DLE)

The error is due to this character. Since <U+0010> is a control character hence it is not being ignored by gcc compiler(whitespace charecters are ignored by gcc compiler) so, it is creating compilation error. Remove this character from your source file and it will solve the problem.

Note: <U+0010> is non printable character so you can't see it. You need to use some hex-editor editor. You can use vim editor. See here and here about how to use it.

comments powered by Disqus