c

How is heap and stack memories mananged, implemented, allocated

Possible Duplicates: How is heap and stack memories mananged, implemented, allocated? Stack,Static and Heap in C++ In C/C++ we can store variables, functions, member functions, instances of a class either on a stack or a heap. How is each implemented? How is it managed (high level)? Does gcc preallocates a chunk of memory to...

Linux redhat kernel-headers

I'm trying to compile a c programming package (thc-ipv6-0.7) on Linux Redhat 2.6.9-42.ELsmp and it's complaining that it can't find "linux/string.h". From google, I learned that this is part of the "kernel-headers" package. If I do "rpm -qa | grep kernel" It shows that "kernel-devel" is installed (which I think I need), but not "ker...

How do I handle argv character array assignments?

I found two ways of passing command-line arguments into a character array: int main (int argc, char **argv) { const char *s1 = argv[0]; char s2[256]; strcpy(s2, argv[0]); printf("s1: %s\ns2: %s\n\n", s1, s2); } Compiled with the IBM xlc compiler on an AIX system Returns [MyPrompt]> ./a.out s1: ./a.out s2: ./a.o...

Disable warning messages in GCC through header files?

I am using the function gets() in my C code. My code is working fine but I am getting a warning message (.text+0xe6): warning: the `gets' function is dangerous and should not be used. I want this warning message not to pop up.Is there any way? I am wondering that there might be such possibilities by creating a header file for disabli...

Good school-type projects or assignments for (re)-learning C?

What are some good projects to work on in an effort to learn (or relearn) C? Ideally something akin to the assignments one might get in a class at university. Links to actual assignments/project specifications that are available online would ideal. Note: they don't have to be assignments specifically from a C class or anything like that...

Win32 API to do wildcard string match

Hello, I am looking for a wildcard string match API (not regex match). I cannot use anything other than Win32 APIs. ...

C#: Order of function evaluation (vs C)

Take the following C code (K&R pg. 77) : push(pop() - pop()); /* WRONG */ The book says that since - and / are not commutative operators, the order in which the 2 pop functions are evaluated is necessary (obviously, to get the correct result)...and thus you have to put the result of the first function in a variable first and then pro...

Interupting program flow in C

Okay, here's my problem: I've got a loop running that increments the value of a variable each iteration, and I want to be able to hit a key on the keyboard to stop the loop and report the final value of the variable. Thing is, I can't figure out how to do this in C. I feel stupid because it seems like I'm overlooking some really simple a...

How to get the mysql table columns data type?

Hi friends, i want to get the column data type of mysql table. Though MYSQLFIELD structure but it was enumerated field types. then i tried with "mysql_real_query() " for me the error which i am getting is "query was empty" pls help to get the column data type thanks in advance krishna ...

Structure padding in C

I've read this about structure padding in C: http://bytes.com/topic/c/answers/543879-what-structure-padding and wrote this code after the article, what should print out size of 'struct pad' like 16 byte and the size of 'struct pad2' should be 12. -as I think. I compiled this code with gcc, with different levels of optimization, even the ...

C version of C++ std::map

Is there a C library version of the C++ std::map in a standard library? ...

How do I ensure my program runs from beginning to end without interruption?

Hi, I'm attempting to time code using RDTSC (no other profiling software I've tried is able to time to the resolution I need) on Ubuntu 8.10. However, I keep getting outliers from task switches and interrupts firing, which are causing my statistics to be invalid. Considering my program runs in a matter of milliseconds, is it possible t...

I need some help to start writing a graphical z80 emulator in c or c++.

Hello, I want to take an interest in writing my own simple emulator for the z80 processor. I have no experience with this type of programming. I am mostly fine with using c-based languages as they are the ones I know best. If anyone could please tell me what I need to accomplish this and give me some good tutorials/references that could ...

C: Personal Preprocessor Directives

Being a C novice I would like to hear what Macro "define"s developers are using. I've been thinking about putting these in a header to skip verbosity I've become used to: #define TS_ typedef struct { #define _TS(x) } x; #define I(x)_ { int i; for ( i = 1; i <= x; i++ ) { #define _I } } Can I add \n \t etc within these macros? ...

C : Code still runs without any includes (Bloodshed's Dev-C++)

I am currently learning and experimenting with C and am using Bloodshed's DEV-C++ as an IDE. Now, I just realized that the following piece of code (as it is...no includes or nothing) compiles and runs : main () { printf("%d", strlen("hello")); } Now, if I'm not mistaken, shouldn't two header files be included in this source fo...

How can I send a string serially from an 8051 only ONCE?

Hello everyone, I am making an 8051 microcontroller communicate wirelessly with a computer. The microcontroller will send a string to its serial port (DB9) and the computer will receive this string and manipulate it. My problem is that I do not know how to make the 8051 transmit the string just once. Since I need to manipulate the st...

malloc() function in c.

Can anyone please explain this? struct node { int data; struct node * link; } main() { struct node *p, *list, *temp; list = p = temp = NULL; ......................... ......................... } addbeg() { int x; temp=malloc(sizeof(struct node)); scanf("%d", &x); temp->data=x; t...

Sockets & Data Persistence

Hi, This is potentially a newbie question, but if i open and write some data to a socket, then exit the subroutine so the socket goes out of scope, and then try and read the data from another program, at a later time, will the data still be there or does it die when the original declarations go out of scope ? Thanks, N. Further info...

Persistent database connection in C

How would I achieve a persistent database connection in C? Please help me. ...

Why C/C++ does not defined expression evaluation order?

As you may know C/C++ does not specified expression evaluation order. What are the reasons to left them undefined. ...