C is a general-purpose computer programming language used for operating systems, games and other high performance work.
3
votes
3answers
83 views
How hard is it to migrate if one has practiced C/C++ only on Windows & never in Unix-like OSes like Linux?
I was confused about whether to post it on Meta or here, but then decided the latter. In compliance with SO T&C, I don't intend to debate which is better. I only need an objective & technical ...
-2
votes
0answers
85 views
Please tell me the output of this C program and also explain how it comes? [closed]
void xyz(int x)
{
printf("\n%d",x);
if(x)
xyz(x-1)
printf("\n%d",x);
}
void abc(int a)
{
printf("\n%d",a);
xyz(a);
if(a)
abc(a-1);
printf("\n%d",a);
}
void main()
{
abc(2);
}
-4
votes
1answer
68 views
C programming question help please? [closed]
What does the expression S+=i*(2*(i%2)-1) mean while writing a code in C?
I know that % 2 mean dividing something and the remainder is our answer but how about the whole thing?
4
votes
2answers
169 views
Why use typedefs for structs?
in C (ANSI, C99, etc.), structs live in their own namespace. A struct for a linked list might look something like this:
struct my_buffer_type {
struct my_buffer_type * next;
struct ...
-1
votes
0answers
96 views
'delete' operator in dynamic memory allocation [closed]
In c++, I know that when a memory space is deallocated with a 'delete' operator and then one try to fetch what the pointer points to after the deletion, it always gives an unpredictable output. ...
0
votes
1answer
47 views
implementing asychronous udp socket in c
so far I've been trying a single server+single client udp chat application where both server and client should be able to communicate with each other freely(as in regular chat applications). for this ...
3
votes
2answers
343 views
Why is C so high in TIOBE index of popularity, while C++ is just under here too, but not as popular? [closed]
I can't get my head around this. If C is so much used, but C is not C++, can someone explain to me the most important reasons that makes C more used than C++ ? Where is all this C code written for ?
...
0
votes
0answers
24 views
Data-structures and memory allocation [closed]
I have a structure:
struct student
{
int id_number;
char first_name[30];
char gender;
};
When I try to enter the gender field it does not work. Skip over this step. Why does that ...
1
vote
2answers
91 views
What is the best programming language to do crypto running time measurement?
I am trying to measure the running time of different crypto algorithm. e.g. how long it takes to encrypt/decrypt a block of plaintext. May I ask if C with OpenSSL is the best PL to do this?
1
vote
2answers
167 views
Why can't we declare 'extern C' for C++ macro's?
I am new to C/C++. Wanted to know why we cannot declare 'extern C' for C++ macro's similar to methods/functions...which will allow macro's defined in C++ file to be accessed in .c files.
Thanks in ...
0
votes
0answers
5 views
C union char array prints 'd' on mac? [migrated]
I am new to C/C++, but was curious to know about the issue i am seeing.
typedef union
{
int a;
float c;
char b[20];
}
Union;
int main()
{
Union y = {100};
printf("Union y :%d - %s - %f ...
2
votes
2answers
132 views
Send stdout or stderr to a new thread
For performance issue I want the logging send to a new thread.
While the main program can work, the new thread can write the error or other messages to a file without effect to the main program. How ...
3
votes
3answers
177 views
Understanding stack frame of function call in C/C++?
I am trying to understand how stack frames are built and which variables (params) are pushed to stack in what order? Some search results showed that the C/C++ compiler decides based on operations ...
-3
votes
0answers
58 views
how to declare and initialze an integer variable [closed]
I want to declare some variables in MIPS(Assembly) and initialize them.I am parsing a C file.I initialize the variables like this:
.data
.text
.globl main
.align 2
a: .space 4
main:
...
0
votes
0answers
5 views
Can I auto join a list of function by C Macro [migrated]
I want to auto join a list of functions begin FUN_BEGIN() & FUN_END() macro, if I write it as:
FUN_BEGIN()
FUN_DEFINE(f1) {
printf("f1\n"); }
FUN_DEFINE(f2) {
printf("f2\n"); }
...