Did you mean to say that memory available in stack is limited compared to heap (I got this impression because the discussion was about allocating memory on the heap)?
If so, why would that be? I...
Type: Posts; User: Nwb
Did you mean to say that memory available in stack is limited compared to heap (I got this impression because the discussion was about allocating memory on the heap)?
If so, why would that be? I...
Is it necessary to call free() when you're about to reach program termination? The entire program is about to be unloaded anyway..
thanks all
global constants too?
Since #define doesn't allocate any memory as const int does, why don't we use #define for all our global constants?
When to and when not use #define?
I have a bunch of constants:
const int SCREEN_WIDTH = 500;
const int SCREEN_HEIGHT = 500;
const int MAZE_WIDTH = 21;
const int MAZE_HEIGHT = 21;
const int TILE_SIZE = 50;
I understood, thanks
I had just read about streams. I had read that the stdin was line buffered in my compiler. So I thought the reason getchar() didn't immediately read the character was because of this line buffering....
#include <stdio.h>
int main() {
setvbuf(stdin, NULL, _IONBF, 0);
int input;
input = getchar();
printf("\n%c", input);
thanks salem.
But won't different processors have different instruction set? How does the assembler figure out what the instruction set of the processor is?
How do C compilers convert C source code into machine code? Does the C compiler convert its code into assembly language and then automatically find and use the assembler for that particular processor...
ok, thanks for replying Fred.
@thmm thanks for replying, yeah, looks like linked nodes are the way to go.
One more question.
void destroy_queue ( QUEUE *q, void ( *dtor ) ( void * ) )
{
NODE *n;
while ( q->head )
{
Ok, thanks Fred and Malcolm. :D
Thanks Malcolm.
" It can't send a message to stderr because that might not make sense in the context of the program."
I didn't understand this sentence.
Thanks a lot for replying flp1969!
Wow. It's really amazing. I never knew you could do stuff like that (the polymorphism). That's a really neat hack, thanks a lot.
Took me some time to...
Thanks a lot Malcolm McLean and john.c! So it's better to use the standard library whenever possible huh?
my 200th post. yey.
I've implemented a Queue Data Structure which stores struct Coordinate data elements.
struct Queue is the structure which stores the queue.
-> It has a size to represent the queue's size
(is it...
Wow that is complicated.. thanks
Thank Salem, hamster_nz and laser light.
char* my_string = "oello world";
my_string[0] = 'h';
printf("%s", my_string);
This snippet gives me a "Segmentation fault" in onlinegdb.com's C compiler. Why does it give a...
How is tolower() implemented by the standard library if alphabets are not guaranteed to be continuous?
Lag does Lag
Yes I saw that the text is formatted. But how does he copy the formatting as well?
I use Visual Studio too.