When declaring an array in C like this:
int array[10];
What is the initial value of the integers?? I'm getting different results with different compilers and I want to know if it has something to do with the compiler, or the OS.
...
Whats the different between IPC and Unix domain sockets and named pipes?
I got vague definitions from various books but couldn't get clarity on which one should be used where.
...
How do I put the value of 0x04 in register 4 if the instruction was 1rxy?
1RXY-Load register R with the value at memory address XY
#include <stdio.h>
unsigned char r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,ra,rb,rc,rd,re,rf;
void reg_check(unsigned char reg);
void rxy1(unsigned char reg, unsigned char val);
int main(){
unsigned char memloc1=...
long long int A = 3289168178315264;
long long int B = 1470960727228416;
double D = sqrt(5);
long long int out = A + B*D;
printf("%lld",out);
This gives result : -2147483648
I am not able to figure out why (it should be a positive result).
Can somebody help?
...
I'm trying to decode base64-encoded string with openssl. However, it works only 4 times out of 5.
Decoded string should always be 64 chars long. BIO_read() always returns 64. However, sometimes returned buffer is shorter than 64!
Any ideas what is wrong? How can i always get the correct string?
...
I have a project written in C that originally was being done on Linux, but now must be done on Windows. Part of the code include this line in several places
asm("movl temp, %esp");
But that causes an "undefined reference to `temp'" error.
This has no problem compiling on Linux using the gcc 4.3.2 compiler (tested on another machine)...
This question is very similar to that one, but I need to do the same thing in C, not python. Here are some examples of what the function should do:
input output
< <
> >
ä ä
ß ß
The function should have the signature char *html2str(char *html) or similar. I'm not reading byte by byte from a stream.
Is t...
When -fomit-frame-pointer is used (automatic for various -O settings), performing a backtrace is problematic. I am wondering if there is a way of determining at compile time that the code is compiled with this switch? In that case, I could put in an #ifndef to guard against backtracing when ill-advised.
Is any macro set when this -fom...
I don't get this one!
#include <stdio.h>
int main()
{
unsigned short t1 = 0, t2 = 0;
if( t1 < t2-1 )
printf(" t1 < t2-1\n");
unsigned long s1 = 0, s2 = 0;
if( s1 < s2-1 )
printf(" s1 < s2-1\n");
}
this results in:
s1 < s2-1
Either both should fail or both not. I tried this with gcc 4 & 4.2
...
i've seen this done long ago with hlsl/glsl shader code. using a #include on the source code file that pastes the code into a char* so that no file io happens at runtime.
if i were to represent it as pseudo-code it would look a little like this:
#define CLSourceToString(filename) " #include "filename" "
const char* kernel = CLSourceToS...
I have built a web service that uses DLLImport to access unmanaged code. The service works just fine running in ASP.NET server but the application is generating an error once I run it from IIS. I have checked permissions, moved ddl to system32, etc. I am not sure what else to do, the service needs to run in IIS. What should I do?
...
I have a unsigned char buffer, and I'm wondering how I would write and read signed and unsigned bits to this byte buffer.
In the Source Engine there is a class named bf_write, which two main methods (used by WriteString, WriteChar, WriteLong, etc.) use two functions named WriteUBitLong and WriteSBitLong.
Thanks in advance
...
I've been going through the K&R C Programming Language book and I'm stuck on Exercise 2-6 which reads:
Write a function setbits(x,p,n,y) that returns x with the n bits that begin at position p set to the rightmost n bits of y, leaving the other bits unchanged.
I'm having trouble understanding the exact thing they're looking for me...
I'm initializing an unsigned short int with a = 0xff (all bits are set).
Then I assign b to a>>7 which should yield (0000 0001) and it does. However, the odd thing is that when I assign c to a<<7, it isn't equivalent to (1000 0000). I tested this by outputting 0x80 (which is 1000 0000) and c, but they aren't the same.
Here is some code:...
Hey everyone, just a quick thing, I have the hex to integer working, but I need to get the numbers lowercase. Here's what I have, any ideas to get to get the A thru F case insensitive?
int htoi(char f[]) {
int z, n;
n = 0;
for (z = 0; f[z] >= '0' && f[z] <= 'F'; ++z)
if (f[z] >= 'A' && f[z] <= 'F')
n ...
I'm currently taking a math class in College called "Scientific Computing" and the professor told us that C is the most common language used for, well, scientific computing and am just wondering as to how accurate this professor is?
...
I have a functions nested relatively deeply in a set of tables. Is there a way in C/C++ to get a "reference" to that function and push that (and args) onto the stack when I need to use it?
...
Hi guys, I programming a 16f84a pic in hitech C to drive a hd44780 lcd. So far I've got the lcd initialized and can write individual characters and strings to the lcd. Now I need to do something like this:
var = 250;
lcd_write_string("MyVar has value: " + var);
so the lcd should show "MyVar has value: 250"
First of all how should I con...
I've been told that if I'm coding in ANSI-C to declare in the order that the variables will be used, assert that pointers are not null and that indices are within bounds, and to initialize just before usage of the variable.
If I declare a const can I initialize it after a block of assertions and code ?
In Java final initializations must...
I'm trying to call a function in a Python script from my main C++ program. The python function takes a string as the argument and returns nothing (ok.. 'None').
It works perfectly well (never thought it would be that easy..) as long as the previous call is finished before the function is called again, otherwise there is an access violat...