Allocate memory for a linked list struct with or without casting? after figuring out, how the linked lists stuff works in C I was just wondering how to correctly allocate a new node.  So lets say my linkedlist is defined with the following struct:  typdef struct NewNode {   int data;   struct node *next; } Node;   Now I'm going to create a new temporary node for whatever reason:  node *temp = (node*) malloc(sizeof(node);   Do I need the cast (node*) or can I as I've seen in couple tutorials leave this without the casting. If not can you tell me what possible errors could occur as my implementation without the casting is completly working.  node *temp = malloc(sizeof(node);
Do I cast the result of malloc? In , someone suggested in a  that I should not cast the result of malloc. i.e., I should do this: int *sieve = malloc(sizeof(int) * length);  rather than: int *sieve = (int *) malloc(sizeof(int) * length);  Why would this be the case?
Existence of the moment generating function and variance Can a distribution with finite mean and infinite variance have a moment generating function? What about a distribution with finite mean and finite variance but infinite higher moments? JavaScript open in a new window, not tab I have a select box that calls window.open(url) when an item is selected.  Firefox will open the page in a new tab by default.  However, I would like the page to open in a new window, not a new tab.    How can I accomplish this? Understanding DNA match of 1,723 cM Let be the next equivalence relation on $B= \{R \subseteq \mathbb{N}\times\mathbb{N} \ | \ R \ is \ a \ well-order \ on \  \mathbb{N}\}$ : $$"R \equiv R' \leftrightarrow \ (\mathbb{N},R) \cong (\mathbb{N},R') \ are \ well-ordering \ sets \  isomorphic" $$  Which is the cardinality of $B/\equiv$?  Firstly, we can notice that each well-ordering set is isomorphic to an ordinal $\alpha \ $such that $\alpha &lt; \aleph_{1}$, and so it is enough to count how many ordinals are isomorphic to a subset of $\mathbb{N}$. For example, if we consider $A$ the set of the even numbers and $B$ the set of odd numbers with the usual order relation, $A \oplus B$ is isomorphic to $\omega + \omega$. Another example could be: if we consider the order of $\mathbb{N}$ that we use in Sharkowski Theorem, that order is isomorphic to $ \omega^{2} + \omega$. Working with prime numbers we could build also $\omega^{n} \ \forall n \in \mathbb{N}$, and so $\omega^{\omega}$ and maybe something bigger. However, we know that each countable ordinal is isomorphic to a subset of $\mathbb{Q}$, but I bet that the same result is not true for $\mathbb{N}$ because it is "too small".  What can I do? Is "am" in "I am right" an auxiliary verb? Consider these sentences:     The ice was thick enough to walk on.      They were in a hurry.      There is enough salt in it.      It is freezing.      I am right.   Are the italicized verbs auxiliary verbs?    Update: Let me explain why I asked this question.  The above sentences are from exercise 6 "Auxiliary verbs" from the book .  From the 36 sentences in exercise 6, all except the above mentioned five sentences are indeed sentences that contain auxiliary verbs (may, must, can, will, had, etc.).   So, what happened here? Why are those five sentences in this exercise? Is it an oversight?    View image in full resolution here: How long will foods that have "Best by: XX-XX-XX" on the product last past that date?  I have tried looking online, and all I can find is anecdotal evidence, which isn't very assuring for me since there seems to be no specific "x food will expire y weeks after its best by date".  Is there a rule of thumb or some guide out there that can tell me how long a "best by" food will last? Or is it safe to assume that they never expire, since it's not actually labelled on the product? How to get Microsoft Search to index common file types like .pdf and .pub I'm trying to get Windows Search (4.0) to index PDFs and .pub, .doc, etc. files.  The files are on an XP Pro PC acting as a file server. But I don't have MS Office, etc. installed (no need, trying to keep it "slim and trim") but WS 4.0 is doing the indexing of those files and not indexing .pdf and .pub.  I've found a few  (from Foxit PDF reader) rated 3/5 and only support WS 2.0 or 3.0.  Looking for other solutions and also a way to index .pub files. Who in the DC Universe can stop Superman if he has a breakdown? Is there anything or anyone in the DC universe that can defeat Superman just in case he goes berserk on everybody?  Maybe Batman stores kryptonite in his Cave or something. I don't know if Batman actually has kyptonite, the example was just a theoretical example.  Who can stop Superman if needed, and how? Which is the best workflow to follow when texturing and importing textures from Substance Painter? So, I'm planning to texture a model using Substance Painter and will render it using the Cycles Render Engine. I will be also using the Principle Shader, heavily, to achieve realistic renders. So, which workflow in Substance Painter so that the textures are accurately rendered in Blender? Specular-Glossy? Or should I go with Metalic-Roughness? Where can I see my full list of Questions and Answers in my profile page of Stack Exchange Android App? I want to see all my Questions and Answers in a particular SE site -  - profile page through Stack Exchange Android App. How can I see that? When I tried to see that I found only Top Posts(5) and Top Tags. Is there a closed form solution for the following series? (Without Using Gamma Function): $$ S=\sum _{i=1}^{n-1} \frac{1}{(i+1)!} $$ Performance of Non Clustered Indexes on Heaps vs Clustered Indexes compares the performance for individual select/insert/delete/update and range select statements on a table organized as a clustered index vs that on a table organized as a heap with a non clustered index on the same key columns as the CI table.  Generally the clustered index option performed better in the tests as there is only one structure to maintain and because there is no need for bookmark lookups.  One potentially interesting case not covered by the paper would have been a comparison between a non clustered index on a heap vs a non clustered index on a clustered index. In that instance I would have expected the heap might even perform better as once at the NCI leaf level SQL Server has a RID to follow directly rather than needing to traverse the clustered index.   Is anyone aware of similar formal testing that has been carried out in this area and if so what were the results? Since when did kidnapping come to include adults too? As per , the word 'kidnap' originated to denote nabbing away of a child. When and how did kidnap come to denote nabbing of adults?  Update: Just found a link to a  that mentions kidnapping of souls. Now not sure how correct the above link is. Can anyone come up with an explicit example of two functions $f$ and $g$ such that: $f\circ g$ is bijective, but neither $f$ nor $g$ is bijective?  I tried the following: $$f:\mathbb{R}\rightarrow \mathbb{R^{+}} $$ $$f(x)=x^{2}$$  and  $$g:\mathbb{R^{+}}\rightarrow \mathbb{R}$$ $$g(x)=\sqrt{x}$$  $f$ is not injective, and $g$ is not surjective, but $f\circ g$ is bijective  Any other examples? Assuming a simple grep such as:  $ psa aux | grep someApp 1000     11634 51.2  0.1  32824  9112 pts/1    SN+  13:24   7:49 someApp   This provides much information, but as the first line of the ps command is missing there is no context for the info. I would prefer that the first line of ps be shown as well:  $ psa aux | someMagic someApp USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND 1000     11634 51.2  0.1  32824  9112 pts/1    SN+  13:24   7:49 someApp   Of course, I could add a regex to grep specifically for ps:  $ ps aux | grep -E "COMMAND|someApp"   However, I would prefer a more general solution as there are other cases in which I would like to have the first line as well.  Seems like this would be a good use case for . Do you need line of sight to cast spells on someone? In "Tasksel" how do I select a package? I found a video on YouTube that shows someone using the command tasksel from the server's boot menu after a fresh install of Ubuntu Server. Simple enough it looked like, but when I go to the options I want to choose for installation it has no information on how to select them, and when I click Enter on one of them it takes me back to the command prompt.  So how do I make a selection of the items listed under tasksel?  I have tried Shift++ to add, but no luck. Anyone know?  I want to install Ubuntu Desktop, as Ubuntu GNOME GUI is not an option in the listing for Ubuntu 17.10 Server. How to find integer solutions to $M^2=5N^2+2N+1$? How do I tell Maven to use the latest version of a dependency? Setting proxy for apt from terminal Possible Duplicate:          I have tried changing my proxy settings in a terminal as:  export HTTP_PROXY=http://10.1.3.1:8080   and  export http_proxy=http://10.1.3.1:8080   but when I try to install a new package or update apt-get, apt-get starts displaying messages from which it seems it is trying to connect to a previously set proxy:  sudo apt-get update   0% [Connecting to 10.1.2.2 (10.1.2.2)] [Connecting to 10.1.2.2 (10.1.2.2)   I have tried setting the proxy via bashrc file but that din work either. As far as I remember 10.1.2.2 was set using GNOME GUI but I don't have access to the GUI right now so I am trying to set it from terminal.