This question already has answers here:
"Stray '\226' in program" compiler errors [duplicate]
(2 answers)
Closed 7 years ago.
theRunners[i] |= (1ULL << (((runnerList)atoll(token)) – 1ULL));
Why is the line giving the following strange error?
error: stray ‘\226’ in program
What's wrong?
In the text you have pasted: the – sign is actually the character 0x96, which in the Windows-1252 code page is a sort of hyphen.
You must use the ASCII minus sign instead; try deleting that piece of code and re-typing it.
Make sure you are using a plaintext editor - some word processors will automatically change punctuation to "funky" alternative versions.
Related
This question already has answers here:
C++ illegal digit, simple issue
(4 answers)
How does C Handle Integer Literals with Leading Zeros, and What About atoi?
(8 answers)
Closed last year.
Hello I'm a college student and I'm using Visual Studios 2022 for my C++ class,
I was doing a project and I couldn't debug it. This is what it shows when I press f5:
Remove zero from the beginning of const int STUDENT_ID = 0488319
This question already has answers here:
Java regex throws java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence for the letter g
(3 answers)
Closed 2 years ago.
I want to built a calculator which accepts numbers like 1E100 or 1.34E-200. In order to check if the number entered is acceptable i decided to test the condition with my regex:
^-?\\d+\\.?\\d*\\E?\\-?\\d*$
however i get an illegal escape and i dont know why? does reges not accept my E?
You escaped the E, which is not necessary :
^(-?\d+\.?\d*E?\-?\d*)$
Test it here
This question already has answers here:
When were the 'and' and 'or' alternative tokens introduced in C++?
(8 answers)
Closed 5 years ago.
Is the word and equivalent to the && operator?
if (inner > 10 and !id)
{
std::cout << "idle" << std::endl;
}
This code was originally translated from Python.
I was sure that the 'if' line would result in a compilation error. But it does pass.
Visual studio (2015) marks it as an error, but it does compile with g++ (and also on this site https://www.onlinegdb.com/online_c++_compiler) and seems to run as expected.
Is this correct syntax or did I miss something?
Yes, according to:
https://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C++
and is equivalent to && ... another issue is that it is not really widely used and it is one character longer than && ... and we know that C++ programmers try to optimize everything. Even the length of their source code, so don't expect to find it widespread in production code.
This question already has answers here:
Multicharacter literal in C and C++
(6 answers)
What do single quotes do in C++ when used on multiple characters?
(5 answers)
Closed 9 years ago.
C++ seems to allow up to four characters to be held in single quotes, such as:
char c = 'abcd';
but at runtime, only the last value ('d') seems to be actually stored away. This behavior seems to happen for pairs of two, three, or four (at five the compiler finally calls uncle). But what's the deal with this design? I don't really see the logic in it.
This question already has an answer here:
what does DATA TKX/2HKX/ mean in fortran?
(1 answer)
Closed 1 year ago.
Does anyone know the meaning of 4HEND in the following line which comes from an old Fortran code?
DATA XHEND / 4HEND /
4HEND is a Hollerith code to represent the character string "END ". In very old FORTRAN, the variable XHEND might even be a 4-byte integer or real used to hold character data. If implicit typing was in effect in this program, XHEND would have been a real. Another recent question with Hollerith codes: Writing both characters and digits in an array
It replaces assignment
XHEND='END '