Q:

Error: missing terminating double quote character in C

belongs to collection: C Common Errors Programs

0

Error: missing terminating double quote character in C

This Error: missing terminating (") character is occurred, when a constant string or text is not closed in double quotes either you missed closing quotes or using singe quote instead of double quote while closing the string/text.

If string/text is not closed in double quotes, compiler throws this error.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Example 1:

#include <stdio.h>

int main(void) {
    
	//closing double quote is missing 
	printf("Hello world);

	return 0;
}

Output

prog.c: In function ‘main’:
prog.c:6:9: warning: missing terminating " character
  printf("Hello world);
         ^
prog.c:6:9: error: missing terminating " character
  printf("Hello world);
         ^~~~~~~~~~~~~~
prog.c:8:2: error: expected expression before ‘return’
  return 0;
  ^~~~~~
prog.c:9:1: error: expected ‘;’ before ‘}’ token
 }
 ^

Example 2:

#include <stdio.h>

int main(void) {
    
	//closing double quote is missing 
	printf("Hello world');

	return 0;
}

Output

prog.c: In function ‘main’:
prog.c:6:9: warning: missing terminating " character
  printf("Hello world');
         ^
prog.c:6:9: error: missing terminating " character
  printf("Hello world');
         ^~~~~~~~~~~~~~~
prog.c:8:2: error: expected expression before ‘return’
  return 0;
  ^~~~~~
prog.c:9:1: error: expected ‘;’ before ‘}’ token
 }
 ^

How to fix?

In the first program, closing double quote is missing, and in the second program, text is closing by single quote instead of double quote.

To fix this error, use double quote to close the string/text.

Correct code:

#include <stdio.h>

int main(void) {
    
	//closing double quote is missing 
	printf("Hello world");

	return 0;
}

Output

Hello world

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Error: \'Hello\'/Text undeclared while p... >>
<< Error: undefined reference to \'main\' i...