×

C Programs

C Basic & Conditional Programs

C Looping Programs

C String Programs

C Miscellaneous Programs

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?
By IncludeHelp Last updated : March 10, 2024

Error: missing terminating double quote character

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 - Error: missing terminating double quote character

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

C Common Errors Programs »

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.