What is the most unorthodox way to improve the performance of C code? This is no-holds-barred! Everything goes including changing loop structures to gotos, hardcoding anything and everything, using case statements in bizarre ways etc. Don't worry at all about maintainability, readability etc.
p.s. This is practical... and I'm well awa...
I want to compile c program on dos prompt using tcc as well as tc without using c editor. please give the full procedure.
...
How does the following example usage of extern specifer behave.
We have a global variable int x both in files one.c and two.c
We want to use these in three.c so have declared this variable in three.c as
extern int x;
What would happen when we compile and link these files?
My answer is: compilation of all these files should succe...
Hi, I know it's possible to overflow ordinary code:
char string[9];
scanf("%s", string).
But is it possible to overflow scanf("%8s", string)? 8 is just an example.
I know "%8s" works like a delimit, but I also notice when I input string longer than 8 chars, the program will terminate due to:
* stack smashing detected *: ./a.out ter...
Hello, I'm getting error "undefined reference to `pthread_attr_init'", even though that should be in pthread.h. This is in a UNIX environment that should be set up for Pthreads. Also, is a void* a good way to point to the current matrix? Here's my code, any ideas?
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <strin...
Is there any library function available in C standard library to do sort?
...
I have tried but failed to do so. Could I have a push in the right direction?
...
I'm specifically focused on when to use malloc on char pointers
char *ptr;
ptr = "something";
...code...
...code...
ptr = "something else";
Would a malloc be in order for something as trivial as this? If yes, why? If not, then when is it necessary for char pointers?
...
I have this Code, i ran this on Java and C ,but they give me two different Results
What is that makes them to run differently.
x=10;y=10;z=10;
y-=x--;
z-=--x;
x-=--x-x--;
The Output in java for value of X is : 8
and for C it is 6
How these Two compiler Behaves differently for incremented options.?.
...
I am asking here from the perspective of a C programmer using mostly Unix. Is it still worth it to do system programming in C?
...
How to compare two audio files to see the difference of them
...
I want to use lua (that internally uses only doubles) to represent a integer that can't have rounding errors between 0 and 2^64-1 or terrible things will happen.
Is it possible to do so?
...
I noticed that when I make changes to some files and then I type make, it will run certain commands related to those files. If I don't change anything, then make doesn't do anything, saying that the program is up to date. This tells me that make has a way of knowing which files were changed since it was last run. How does it know? It...
Hi all.. i am working in embedded C environment.. can we pass function pointer as an argument to a function in C? if so, can u give me a sample declaration and definition.. thnx in advance
...
In C, is i+=1; atomic?
...
Do exist on msvc and mingw a 64 bits equivalent function to do it ?
Aparently K&R was thinking that 2^32 was enough
...
I'm using CreateFile to open an asynchronous file handle to a Bluetooth HID device on the system. The device will then start streaming data, and I use ReadFile to read data from the device. The problem is, that if the Bluetooth connection is dropped, ReadFile just keeps giving ERROR_IO_PENDING instead of reporting a failure.
I cannot re...
what is the difference between read() and recv() , and between send() and write() in socket programming ? performance and speed and other behavior.
...
I am calling a C process from my Java program, and ending that C process using exit (0).
On Windows machine, under certain conditions it is opening a pop-up window telling me that
"Test.exe has encountered a problem and needs to close. We are sorry for the inconvenience."
Does anyone have a guess why this problem is coming around? I ...
I have used wireshark to see the DHCP packet structure. Now I have created a DHCPDISCOVER request and stored it in 'message'. I then broadcast it on the network.
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
perror("socket");
exit(1);
}
setsockopt(sockfd,SOL_SOCKET,SO_BROADCAST, &on,sizeof(on));
setsockopt(sockfd,SOL_...