C is a general-purpose computer programming language used for operating systems, games and other high performance work and is clearly distinct from C++. It was developed in 1972 by Dennis Ritchie for use with the Unix operating system.
0
votes
0answers
3 views
To what extent is Couchbase a drop in replacement for Memcached
Official couchbase documentation says this in this link - http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-getting-started-nextsteps.html.
"If you already have an application that uses ...
3
votes
2answers
39 views
SubArray, passing address to a function
I have a question regarding passing address of first element of an array to a (recursive) function:
selectionSort( &b[1], size-1);
When address is passed to a function, function parameter must ...
1
vote
2answers
61 views
C struct: what does this mean? [duplicate]
typedef struct{
unsigned flanke:1;
unsigned lastState:1;
} flanke_t;
I do not understand the ":1". Please help me, thx.
2
votes
1answer
53 views
Why is bool/char allocation 4 bytes instead of 1?
I'm trying to load a struct properly which has 1 char as a bool. It looks like it should work fine but when I printf the data at the bool it fails because it reads 4 bytes instead of 1.
typedef ...
0
votes
3answers
79 views
when explicit pointer type cast is needed?
In C, if I have two types of pointers:
typeB *q;
typeA *p;
int the following, is it unnecessary to put an explicit cast (typeA *)
1 p= q is fine, no need to use p = (typeA *)q;
2 ...
4
votes
6answers
83 views
A funny thing with sprintf
I'm so confused with sprintf that a funny problem with different platfrom.
Code :
int main ()
{
char sql[1024];
uint32_t app_id = 32;
uint64_t task_id = 64;
sprintf(sql, "%u, %u", ...
2
votes
2answers
63 views
Programming to fill our system's L1 or L2 cache
How we can systematically write code to load data into our L1 or L2 cache?
I am specifically trying to target filling the the L1 I cache of my system for some higher analysis.
Any suggestions will do ...
0
votes
3answers
42 views
escape characters with strtok
Let's say that I have the following results from an external machine:
Value_1:(A=12.34, B=34.56, C=12.34, D=34.67)
I want with strtok to get these values so I have the following code which do ...
1
vote
1answer
68 views
G++ name mangling of global const variables
Can someone help me understanding the gcc name mangling conventions?
Consider the following test code
#include <stdio.h>
const int x = 42;
int y = 42;
int main( int argc, const char* argv[] ...
-2
votes
3answers
38 views
allocating memory sequencially in C
I wanted to test malloc() to see if allocating to the same adress twice adds up to the memory, or just replaces it: int *ptr = malloc(sizeof(int)); ptr = malloc(2*sizeof(int)); Will this memory be 3 ...
1
vote
3answers
37 views
Printf changing memory values
I'm trying to do some fixed point vector math and it seems that whenever I print anything, doesn't seem to matter what. The value of my vectors change. The code is compiled using ZDSII developer ...
1
vote
1answer
18 views
recvfrom() error 10035 using non-blocking sockets
I am using ioctlsocket() function to make my socket non-blocking but when I call recvfrom(), I get the error 10035 (WSAEWOULDBLOCK).
u_long mode = 1;
ioctlsocket(newSocketIdentifier, FIONBIO, ...
3
votes
2answers
39 views
Doubts regarding Named Semaphore in C Linux
I am using named semaphore in C in Linux to control the access of shared memory across multiple processes.
As of now I have not added any code to sem_close and sem_unlink the semaphore.
So my ...
2
votes
2answers
115 views
Why this C program takes T+1 inputs instead to T?
#include <stdio.h>
int main (void)
{
int T, y, z;
scanf ("%i\n", &T);
for (T; T > 0 ; --T)
{
scanf ("%i\n", &y);
}
return 0;
}
If I input 4, shouldn't it take 4 more ...
0
votes
0answers
12 views
Sqlite3 How to Indentify the table locking status then insert
I am using sqlite3 3.6.23.1 version in fedora linux.I have two threads running to access the database.There is a chance that both thread will try perform write operation in the same table.
Table gets ...