2

I have this on my program and it shows an error saying : Unterminated string.

char Tok[63][63] = {"%%##","\""};

Is there other way to declare the double quotation mark as a string?

LorenzKyle
  • 69
  • 10

1 Answers1

1

This is a bug in Turbo C. I have tried:

char Tok[63][63] = { "%%##", "\"" };

int
main (int argc, char **argv)
{
  return 0;
};

on gcc, in normal mode, C89 mode, and C99 mode with -Wall and it compiles without errors (*). I have also manually reviewed the string and there is no way it is unterminated.

I suggest you use octal within your string literal, i.e.

char Tok[63][63] = { "%%##", "\042" };

and see if Turbo C likes that.

(*) = NB return 0 is not good practice from main() - just there to ensure the code compiles without warnings in the simplest way possible

abligh
  • 24,573
  • 4
  • 47
  • 84
  • This works better than the above answer because you can add nex to it a new element to array without getting error. except that the octal value of double quote is 042. – LorenzKyle Mar 02 '14 at 03:05
  • Oops - hex/octal thinko - fixed. – abligh Mar 02 '14 at 07:27