How do you assign a specific memory address to a pointer ? The Special Function Registers in micro such AVR m128 has fixed addresses, the AVR gcc defines the SFR in the io.h header file but I want to handle it myself, thanks for the help in advance.
Cheers!
...
Does there exist any other alternative data structure instead of struct tm (having same memory allocated as this structure) ? So that I could use strftime without declaring <time.h>
I am aware of the fact that relying on implicit declaration is not good,but I faced this question in an interview.
EDIT: To be precise I was asked to print...
How to design an algorithm to convert a UTF-8 string to a unicode string?
...
Hi, I'm having trouble with what should be a simple program.
I've written a single linked list implementation in C using void* pointers. However, I have a problem, as there is a possible memory leak somewhere, however I checked the code using valgrind and it detected no such errors.
But when all the memory is free'd there is still som...
I need to transform just a few word into commands (5 or so will suffice). For this I'll need a small and fast program. I got started with connecting a microphone to an analog input and reading the values. The values I got are the "sound waves". Has any one got similar experience and knows how to proceed (or has a link to a library that i...
I want my program always know all of the mountpoints. After a quick google I found that getmntent() and friends can tell me what is mounted. I realize I could do this everytime that I needed to know what was mounted, but is there some way to recognise when something gets mounted/unmounted so I don't have to keep reading the file? Is t...
Alright... my Introduction to Data Structures from CS is so rusty I need to ask this here.
I have a linked list whose structure is:
struct Data_Struct {
char *Name;
char *Task;
char *Pos;
struct Data_Struct *Next;
};
typedef struct Data_Struct MyData;
Now, at some point in my application I filled the list with data.
...
Hi,
I was recently editing a Unicode-encoded text file that also includes Thai characters (alongside "normal" characters). For some reason, after each sequence of Thai characters, a new line appeared.
After some mucking around with C, trying to remove all newline characters, I fired up vim to inspect the file. Apparently, after each Th...
Hi,
I am working on a simulation. For this simulation I need 20 nodes (static) and then each node has a queue associated with it. This queue could hold any number of values. What would be the best way to implement this in C? I was aiming at having each of the queues being a simple linked list, but how can I effectively create several qu...
I'm working on a micro-controller without hardware multiply and divide. I need to cook up software algorithms for these basic operations that are a nice balance of compact size and efficiency. My C compiler port will employ these algos, not the the C developers themselves.
My google-fu is so far turning up mostly noise on this topic.
...
I want the parent process to take the arguments to main() and send the characters in them one at a time to the child process through a pipe starting with argv[1] and continue through the rest of the arguments.(one call to write for each character).
I want the child process to count the characters sent to it by the parent process and pri...
Possible Duplicates:
Incrementing in C++ - When to use x++ or ++x?
What is the difference between
for (int i = 0; i < MAX; i++)
{
//...do something
}
and
for (int i = 0; i < MAX; ++i)
{
//...do something
}
?
...
I am designing a Reliable data transmission over UDP, where in the UDP data buffer which is a character array and in my first 2 bytes of it I have to put bits like 00010000.... and so on and I want to know how to achieve this. Please let me know if you need any info, thanks in advance for your help, I really appreciate it
...
I can examine the optimization using profiler, size of the executable file and time to take for the execution.
I can get the result of the optimization.
But I have these questions,
How to get the optimized C code.
Which algorithm or method used by C to optimize a code.
Thanks in advance.
...
I want to comment a line using the pre-processor:
#define open /##*
#define close */
main()
{
open commented line close
}
when I do $gcc -E filename.c I expected
/* commented line */
but I got
/ * commented line */
so that the compiler shows an error
Why it is giving an unwanted space ?
...
I cannot find this in the Apple docs so: what does the "f" after the numbers here indicate? Is this from C or Objective-C? Is there any difference in not adding this to a constant number?
CGRect frame = CGRectMake(0.0f, 0.0f, 320.0f, 50.0f);
Can you explain why I wouldn't just write:
CGRect frame = CGRectMake(0, 0, 320, 50);
...
if we have
char *val = someString;
and then say
if(val){
....
}
what is the if statement actually checking here?
thanks
edit : Thanks for all the replys
...
Are calls to signal() done across all threads in a process? Or do you have to call signal for each signal you want to catch per thread?
Thanks,
Chenz
...
Hello there, This is related to my previous question. Basically, given a string of characters, how do I go through it and assign all the numbers within that string into an integer variable leaving out all other characters?
Not at input but when there is a string of characters already read in through gets();
...
Hi All,
I was just going thro' source code of Yahoo's Trafic Server
It is written in C++.
In almost all methods (from one of modules),
they do void(param) on each param that function receive.
(Eg below)
Can someone explain what this could be for ?
int ...