It is well known that in C, floating point literals (e.g. 1.23) have type double. As a consequence, any calculation that involves them is promoted to double.
I'm working on an embedded real-time system that has a floating point unit that supports…
#include
#include
int main()
{
char * p = "abc";
char * p1 = "abc";
printf("%d %d", p, p1);
}
When I print the values of the two pointers, it is printing the same address. Why?
In JavaScript: {foo: bar, biz: qux}.
In Ruby: {foo => bar, biz => qux}.
In Java:
HashMap map = new HashMap<>();
map.put(foo, bar);
map.put(biz, qux);
Surely Kotlin can do better than Java?
When I tried to add a const array in the global scope using this code:
static NUMBERS: [i32] = [1, 2, 3, 4, 5];
I got the following error:
error: mismatched types:
expected `[i32]`,
found `[i32; 5]`
(expected slice,
found array of 5…
C++03 5.1 Primary expressions §2 says:
A literal is a primary expression. Its type depends on its form (2.13). A string literal is an lvalue; all other literals are rvalues.
Similarly, C99 6.5.1 §4 says:
A string literal is a primary expression.…
JSLint is giving me this error:
Problem at line 11 character 33: Use the array literal notation [].
var myArray = new Array();
What is array literal notation and why does it want me to use it instead?
It shows here that new Array(); should work…
Possible Duplicate:
What are some example use cases for symbol literals in Scala?
What's the purpose of Symbol and why does it deserve some special literal syntax e. g. 'FooSymbol?
I am working on a (Java) project in which I have many jars which have a source-jar file attached.
Is there any way to make the eclipse "File Search" search for Java files (and txt, xml etc. for that matter) containing some string literal inside…
In PHP, I can specify array literals quite easily:
array(
array("name" => "John", "hobby" => "hiking"),
array("name" => "Jane", "hobby" => "dancing"),
...
)
But what if I want array of objects? How can I specify object literal in…
I read some C# article to combine a path using Path.Combine(part1,part2).
It uses the following:
string part1 = @"c:\temp";
string part2 = @"assembly.txt";
May I know what is the use of @ in part1 and part2?
Which C# XML documentation comment tag is used for the literals true, false and null?
In Microsoft's own documentation, these literals appear in bold text. For example, the documentation for the property ArrayList.IsFixedSize appears as:
true if…
I have the function below which accepts a bool pointer. I'm wondering if there is any notation which allows me to set the value of the is field to true in the struct literal; basically without to define a new identifier (i.e. var x := true ;…
I've got a (generated) literal string in C++ that may contain characters that need to be escaped using the \x notation. For example:
char foo[] = "\xABEcho";
However, g++ (version 4.1.2 if it matters) throws an error:
test.cpp:1: error: hex escape…
From the Java tutorial:
Finally, there's also a special kind of literal called a class literal, formed by taking a type name and appending ".class"; for example, String.class. This refers to the object (of type Class) that represents the type…
I have read this. It's octal in C++ and decimal in Java. But no description about C?
Is it going to make any difference if 0 is octal or decimal? This is the question asked by my interviewer. I said no and I explained that it is always 0 regardless…