Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

The GNU C Programming Tutorial - unterminated string or character constant

Node:unterminated string or character constant, Previous:undefined reference to..., Up:Compile-time errors



unterminated string or character constant

This error is often generated by code like the following:

#include <stdio.h>

/* To shorten example, not using argp */
int main()
{
  printf("hello!\n);
  printf("Hello again!\n");
  return 0;
}

The actual error message received was:

missquotes.c:6: unterminated string or character constant
missquotes.c:5: possible real start of unterminated constant

The compiler never found a close quote (") for the string Hello!\n. It read all the text up from the quote in the line printf("Hello!\n); to the first quote in the line printf("Hello again!\n"); as a single string. Notice that GCC helpfully suggests that it is line 5 that actually contains the unterminated string. GCC is pretty smart as C compilers go.

 
 
  Published under free license. Design by Interspire