Home » C programs » Common C program Errors

Error: missing terminating double quote character in C

Here, we are going to learn why an error missing terminating double quote (") character occurs and how to fix it in C programming language?
Submitted by IncludeHelp, on September 08, 2018

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.

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





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.