If I have an int array:  int *array;  array = malloc(5 * sizeof(int));   and I malloc to it as above, I can then access it and set values to it. Everything is fine.  But if I create that int pointer and pass to it a function and malloc inside the function, I can't access/set values to the array unless I pass it to the array as a pointer to a pointer?  some_void_function(int *array) {     array = malloc(5 * sizeof(int)) }  int *array; some_void_function(array);  *(array + 3) = 5; // DOES NOT WORK   To fix it I can make the array accept (int **array) as a parameter and pass in the address of the pointer (so a pointer to a pointer), dereference it, and assign it with malloc:  some_void_function(int **array) {     *array = malloc(5 * sizeof(int)) }  int *array; some_void_function(&amp;array);  *(array + 3) = 5; // WORKS    Could someone explain this to me? Am I not doing the same thing in both situations? Pass the address and then just dereferencing it is the same thing as just pass in the single pointer in the first place right?
I think I've got it down to the most basic case:  int main(int argc, char ** argv) {   int * arr;    foo(arr);   printf("car[3]=%d\n",arr[3]);   free (arr);   return 1; }  void foo(int * arr) {   arr = (int*) malloc( sizeof(int)*25 );   arr[3] = 69; }   The output is this:  &gt; ./a.out   car[3]=-1869558540  a.out(4100) malloc: *** error for object 0x8fe01037: Non-aligned pointer                          being freed  *** set a breakpoint in malloc_error_break to debug &gt;   If anyone can shed light on where my understanding is failing, it'd be greatly appreciated.
What are the rules for China's visa-free transit programs? Help center still has the guidance about old Favorite tags What does $\lim\limits_{x \to \infty} f(x) = 1$ say about $\lim\limits_{x \to \infty} f'(x)$? Given that $f$ is differentiable, what does $\lim\limits_{x \to \infty} f(x) = 1$ say about $\lim\limits_{x \to \infty} f^\prime(x)$ ? Intuitively I feel that it's $0$.  I attempted to solve this by trying to evaluate $$\lim_{x \to \infty} \lim_{h \to 0} \frac{f(x + h) - f(x)}{h} $$ by trying to interchange the limits after showing that $\frac{f(x + h) - f(x)}{h}$ converges uniformly as $x \to \infty$. But I couldn't proceed further.  Trying to work backwards, as a specific example, $f(x) = \arctan(x)$ came to my mind. It's derivative certainly goes to $0$ as $x \to \infty$. Doesn't this show that $\frac{f(x + h) - f(x)}{h}$ converges uniformly to $0$ as $x \to \infty$ ?  I'm totally confused! I would really appreciate if anyone told me what I am doing wrong. how to get the last character of a string? Buying from Play store using a credit card with foreign billing address Is it possible to use a credit card with a foreign billing address to buy items from a local Play store? I have a Visa credit card from a German bank with a billing address in Germany registered in my Google Wallet. I have successfully used my Wallet to pay for online purchases from several online service providers in different foreign currencies so I am sure the credit card is correctly registered in my Wallet account. However, while physically located in the UK, I cannot complete any purchase from the UK Play store. At the point when I need to select my preferred payment method from my Wallet account, it shows my registered credit card greyed out with the text "Unsupported Payment method" next to it. Is it possible to trade CFD without leverage? I'm new to trading. Based on what I read, trading CFD involves high risk because of leverage.   Is it possible to trade CFD stocks without leverage (in Etoro for example)?  If this is possible, then I would lose/gain only the percentage by which the stock goes down/up.  Thank you what could cause a script to fail to find python when it has `#!/usr/bin/env python` in the first line? Trying to get casperjs running on Ubuntu 12.04. After installing it when I run I get:   09:20 $ ll /usr/local/bin/casperjs lrwxrwxrwx 1 root root 26 Nov  6 16:49 /usr/local/bin/casperjs -&gt; /opt/casperjs/bin/casperjs  09:20 $ /usr/bin/env python --version Python 2.7.3  09:20 $ cat /opt/casperjs/bin/casperjs | head -4  #!/usr/bin/env python  import os import sys  09:20 $ casperjs : No such file or directory  09: 22 $ python Python 2.7.3 (default, Sep 26 2013, 20:03:06)  [GCC 4.6.3] on linux2   So Python is present and runnable, casperjs is pointing to the right place and it is a python script. But when I run it I get "No such file".   I can fix it by changing the first line of the casperjs python file from:    #!/usr/bin/env python   to:   #!/usr/bin/python   Result:   $ casperjs --version 1.1.0-DEV   I managed to fix it, but I'm wondering why it didn't work with #!/usr/bin/env python, since that seems to be a normal interpreter line. Do I have something configured wrong?   Here are the steps to get casperjs:   $ git clone git://github.com/n1k0/casperjs.git $ cd casperjs $ ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs $ casperjs : No such file or directory Clone hard drive to another, smaller hard drive Is there a good tool/program that allows me to clone a system drive to another, smaller hard drive?  I've bought a new 64GB SSD drive and would like to move my current Windows 7 Professional 64-bit installation to that new drive. My current drive is a 200GB SATA drive with one partition only. Of course there's enough free space to shrink my current partition to less than 64GB. AND gate made out of transistors letting current pass despite only one input high I recently built a gate with transistors, however my meter reads 1.6 volts when only input B is high, and 2.3 while both are high. How can I fix this? (I used 3 volts instead of 6 and 2k instead of 10k) Find roots of $3^x+x^3=17$ Find $x$ in the following equation: $$3^x+x^3=17$$ Check the uniform convergence of series of functions Check that given series converges uniformly for $x\in(-\pi,\pi)$ or not  1) $\sum_{n=1}^{\infty} (\frac{x}{n})^n$  2) $\sum_{n=1}^{\infty}\frac{1}{((x+\pi)n)^2}$  first series is power series so I find the radius of convergence that comes $R=e$ which is inside the given set so I am not able to give the final conclusion. after this I were thinking to apply $M_n$ test , but I am not able to find $M_n$. Please help to solve this problem. Update pgfmath macro in foreach loop I need to update a variable defined in a pgfmathsetmacro command inside a foreach loop. Apparently, the var is only updated when it is used after the update command. Here is a MWE:  \begin{tikzpicture} \draw [help lines] (0,0) grid (3,3); \pgfmathsetmacro{\a}{1} \foreach \b in {2,3} {     \node [blue] at (\a,0) {\a};     \pgfmathsetmacro{\a}{\b}     \node [red] at (0,\a) {\a}; } \end{tikzpicture}   The red nodes are printed at updated positions and the value printed is also updated; the blue nodes are not: they keep their initial value (1) and are located at the initial position (0,1).  Why is this? Thanks José I'm trying to delete some old flow which are inactive via workbench. DestructiveChanges.xml &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;Package xmlns=&quot;http://soap.sforce.com/2006/04/metadata&quot;&gt;     &lt;types&gt;         &lt;members&gt;Advanced_Round_Robin&lt;/members&gt;         &lt;name&gt;Flow&lt;/name&gt;     &lt;/types&gt;Ï &lt;/Package&gt;  package.xml &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;Package xmlns=&quot;http://soap.sforce.com/2006/04/metadata&quot;&gt;       &lt;version&gt;48.0&lt;/version&gt; &lt;/Package&gt;  I've added both file in zip and in workbench when I deploy using this zip file I get below error.  insufficient access rights on cross-reference id   What permission I need to have to perform this action? Also is there way I can delete few version of same flow only? Like keep only last 3-4 version and delete all previous version of given flow? Thank you. I am trying to understand how complex numbers made their way into QM. Can we have a theory of the same physics without complex numbers? If so, is the theory using complex numbers easier? How can I comment out a block of text in texmaker? I use texmaker and some time ago I found, by chance, a way to comment many lines at once, but I can't remember it now. Can somebody remind me of that? How to find and replace using sed on records starting with Specific number Suppose I look at a parallel plate capacitor in its rest frame and calculate the electrostatic energy, $E$.  Next, I look at the same capacitor in a primed frame boosted in the direction perpendicular to the plane of the plates. In this frame, the $E$-field is the same strength, there is no magnetic field, and the volume over which the $E$-field extends is less by a factor $1/\gamma$. This suggests $E' = \frac{1}{\gamma} E$, but relativity states that energy transforms as $E' = \gamma E$.   Where is the missing energy? How to connect a GUI button to function? Is it possible to assign the same value to multiple keys in a dict object at once? Irreducibles are prime in a UFD