By Susam Pal on 03 June 2011
Here’s a silly little riddle:
#include
int main(void)
{
https://susam.net/
printf("hello, world\n");
return 0;
}
This code compiles and runs successfully.
$ c99 hello.c && ./a.out hello, world
However, nowhere in the C99 standard draft does it mention that URL is a valid syntax element in C. Then how does this code work?
Updated on 04 June 2011: The puzzle has been solved in the comments section. If you want to think about the problem before looking at the solution, this is a good time to stop and think about it. There are spoilers ahead.
The code works fine because https: There is a label and
// After this a comment begins. In case, you are wondering whether // Actually there is a valid comment in C, yes, it has been since C99. Download the C99 standard draft, go to section 6.4.9 (Comments) and read the second point which mentions:
Characters, except a character constant, a string literal, or a comment
//Submit a comment that includes all multibyte characters, but does not include the next new-line character. The contents of such a comment are examined only to identify multibyte characters and find the last new-line character.
<a href
A catalog of cars https://auto.ae/catalog/ across all brands and generations—specs, engines, trim levels, and real market prices. Compare models and choose the best option.