I am trying to understand how exactly structures work in C. More precisely, the size of a structure.  When I print the size of the following structure:    struct Test {    char tab[14]; };   I have the output 14.  But the size of       struct Test2{          uint16_t  a;          uint16_t  b;          uint16_t   c;          uint64_t  d;      };   is equals to 16.  I read in a previous post that there is a "padding added to satisfy alignment constraints". Then why this padding isn't apply to the first example ?
Why does the sizeof operator return a size larger for a structure than the total sizes of the structure's members?
How do I base64 encode (decode) in C? I have binary data in an unsigned char variable. I need to convert them to PEM base64 in c. I looked in openssl library but i could not find any function. Does any body have any idea? General formula of $\sum_{n\ge1}{\binom{2n}{n}^{-k}}$. If $k=1$, we have \begin{align} \sum_{n\ge1}\frac{1}{\binom{2n}{n}}&amp;=\frac12\sum_{n\ge1}n\mathrm{B}(n,n)\\ &amp;=\frac12\int _{0}^{1}\sum_{n\ge1}n(t-t^2)^{{n-1}}{\mathrm  d}t\\ &amp;=\frac12\int _{0}^{1}\frac{1}{(t-t^2-1)^2}{\mathrm  d}t\\ &amp;=\frac13+\frac{2\sqrt3\pi}{27} \end{align} I wonder if there exists a general formula of $\sum_{n\ge1}{\binom{2n}{n}^{-k}}$ with $k\in\Bbb N^*$. This may involve some ${}_pF_q$ functions. There is a remote Windows server on a private network which I can connect to via Remote Desktop Connection.  I would like to be able to make TCP/IP connections from my computer to other computers on that server's network.  Remote Desktop Connection makes it possible to share printers, drives, and other local resources through the connection.  Is there any way to "tunnel" a TCP/IP connection via RDC?  I'd like something similar to the port-forwarding provided by SSH.  I don't see any way to do this via RDC, but I'm hoping the capability is there and I just don't know about it. I already have cast iron skillet but I can't find a decent "normal" pan, for eggs and stuff, sometimes steaks, more or less general purpose.   Here are some more features: high quality, durable, non stick, oven safe, dish washer safe, extremely flat surface - not to be higher in the middle, this is very important.  Of course pricier usually means better quality, but is it worth it based on the criteria I'm after? Is it likely to be worth going from pans below $60, to pans from $60 to $130, or to pans over $130? Grammatical number agreement in a complex phrase using singular "they" Let us view our deleted comments If moderators can view , can we see comments we've deleted? We can see our deleted answers, but why not our deleted comments? Potential difference across a zero resistance wire So I started off with electrostatics and everything seemed nice and mathematical and justified and then "DC circuits" happened!  I just cannot understand the model of electron flow in electrical circuits.  Here are my specific doubts-:  1) If potential difference across a tiny cross section of conducting wire is zero, then why on earth does electron flow across that cross section at all? Never mind potential difference across the whole circuit.   2) Is there a constant electric field across a wire connected to a battery? If yes then how is potential difference across a zero resistance wire constant?   Shouldnt it be increasing?  Doesnt it violate ohms law?  If no,  then why do electrons flow at all?  Please take time to consider these doubts and relieve me of my frustration.  I havs searched through the net for this but every answer seems like beating around the bush.  All of the 4 books I have consulted do not address these facts to my satisfaction.   Frankly I think nobody understands this. "To shoot out of cannon into sparrows" In Russian we have idiom/saying "To shoot out of cannon into sparrows" (literal translation) which is used to convey an idea of applying too drastic measures to small problems. I believe there should be some native-English equivalents to this saying. Can you share if there are any? I've allocated an "array" of mystruct of size n like this:  if (NULL == (p = calloc(sizeof(struct mystruct) * n,1))) {  /* handle error */ }   Later on, I only have access to p, and no longer have n. Is there a way to determine the length of the array given just the pointer p?  I figure it must be possible, since free(p) does just that. I know malloc() keeps track of how much memory it has allocated, and that's why it knows the length; perhaps there is a way to query for this information? Something like...  int length = askMallocLibraryHowMuchMemoryWasAlloced(p) / sizeof(mystruct)   I know I should just rework the code so that I know n, but I'd rather not if possible. Any ideas? How are reviews assigned? I've a set of regions within a city. I'd like to split each region into five subregions and then get the centroid of each one of them.  I know how to make a vector grid, but the problem I have is that the generated points are not taking into account the regions, they're only related to the general map.  I have this:    And I want to split each region in five equal size areas. Something like this:    I'd like to build a visualization similar to this one: . In order to accomplish that, I need to split each region, because the original ones are pretty big. "Baggage" versus "luggage" I have the feeling that luggage is more closely associated with vacation travel, whereas baggage is for general transportation.  Or... are they just exact synonyms? proof that translation of a function converges to function in $L^1$ Let $f \in L^1(\mathbb{R})$, for $a\in \mathbb{R}$ let $f_a(x)=f(x-a)$, prove that: $$\lim_{a\rightarrow 0}\|f_a -f \|_1=0$$  I know that there exists $g\in C(\mathbb{R})$ s.t $\|f-g\|_1 \leq \epsilon$, this is also true for $f_a$ and $g_a$.  Now I have the next estimation:  \begin{align*} \|f_a-f\|_1 &amp;= \int_{\mathbb{R}} |f(x)-f(x-a)| dx \\ &amp;= \int |f(x)-g(x)+g(x)-g(x-a)+g(x-a)-f(x-a)| \\ &amp;\leq \|f-g\|_1 + \|f_a-g_a\|_1 + \int |g(x)-g(x-a)| \end{align*} my question is: I can argue that $\lim_{a\to0} \int |g(x)-g(x-a)| = \lim_{a\to0} \lim_{T\to\infty} |g(x_0)-g(x_0-a)| 2T$, now I think that I can change the order of the limits here, but I am not sure why?  P.s $x_0$ is some point in $[-T,T]$, and the above is valid from the intermediate integral theorem for continuous functions, right?  Thanks. Syntax error while defining an array as a property of a class To illustrate, assume that I have two tables as follows:  VehicleID Name 1         Chuck 2         Larry  LocationID VehicleID City 1          1         New York 2          1         Seattle 3          1         Vancouver 4          2         Los Angeles 5          2         Houston   I want to write a query to return the following results:  VehicleID Name    Locations 1         Chuck   New York, Seattle, Vancouver 2         Larry   Los Angeles, Houston   I know that this can be done using server side cursors, ie:  DECLARE @VehicleID int DECLARE @VehicleName varchar(100) DECLARE @LocationCity varchar(100) DECLARE @Locations varchar(4000) DECLARE @Results TABLE (   VehicleID int   Name varchar(100)   Locations varchar(4000) )  DECLARE VehiclesCursor CURSOR FOR SELECT   [VehicleID] , [Name] FROM [Vehicles]  OPEN VehiclesCursor  FETCH NEXT FROM VehiclesCursor INTO   @VehicleID , @VehicleName WHILE @@FETCH_STATUS = 0 BEGIN    SET @Locations = ''    DECLARE LocationsCursor CURSOR FOR   SELECT     [City]   FROM [Locations]   WHERE [VehicleID] = @VehicleID    OPEN LocationsCursor    FETCH NEXT FROM LocationsCursor INTO     @LocationCity   WHILE @@FETCH_STATUS = 0   BEGIN     SET @Locations = @Locations + @LocationCity      FETCH NEXT FROM LocationsCursor INTO       @LocationCity   END   CLOSE LocationsCursor   DEALLOCATE LocationsCursor    INSERT INTO @Results (VehicleID, Name, Locations) SELECT @VehicleID, @Name, @Locations  END      CLOSE VehiclesCursor DEALLOCATE VehiclesCursor  SELECT * FROM @Results   However, as you can see, this requires a great deal of code.  What I would like is a generic function that would allow me to do something like this:  SELECT VehicleID      , Name      , JOIN(SELECT City FROM Locations WHERE VehicleID = Vehicles.VehicleID, ', ') AS Locations FROM Vehicles   Is this possible?  Or something similar? Under what conditions does loot despawn? I have found that when my bags get full and I need to vendor loot I can sometimes leave loot on the ground and return to it.  Other times it seems to disappear almost instantly once I leave the area.  Is the loot despawn time based, based on my distance from the dropped loot, or some other factor(s)? My objects are semi-transparent, and not one behind the other in the compositor How to install Google Chrome How do you install Google Chrome on Ubuntu? How to draw arrows between circled coefficients of polynomials using tikz Windows Phone ReverseGeocoding to get Address from Lat and Long