bitshifting1220 (4/28/2008 9:20:44 PM) comp.lang.c Hi everyone, I'm trying to get my head around the concept of bit shifting, and there are some things that seem to elude me. Many thanks for your answers. 1. When shifting bits, is there a certain bit size you... Alef
checking if pointer is NULL allowed?5118 (1/24/2007 5:59:41 PM) comp.lang.c Hi, Just to check, if i set a pointer explicitly to NULL, i'm not allowed to dereference it? Why is that, it's not like it's pointing to any garbage right? Why else set it to NULL. I can remember some instanc... atv
weird problem #21820 (1/24/2007 5:30:27 PM) comp.lang.c at least to me it is. I can't figure out for the life what it is i'm doing wrong here. i have a function called assign_coordinate. usually, i pass a malloced pointer to it, then individual pointers are malloc... atv
is comparing pointers valid?739 (1/24/2007 2:05:56 PM) comp.unix.programmer Like so: while(search!=NULL) { if(!strcmp(tmp->x,search->x)&& !strcmp(tmp->y,search->y)&& !strcmp(tmp->z,search->z)&& tmp!=search) { /* To exclude ourselves from search */ printf("Coordinates in use\n"); } sea... atv
algorithm question #2240 (1/22/2007 10:53:46 PM) comp.unix.programmer Hi, I'm not sure if this is the right newsgroup for this, but maybe someone here has some experience with this kind of thing. I want to size my map according to the objects i have. My map is tiled up in squa... atv
using random functions645 (1/22/2007 11:25:59 AM) comp.unix.programmer Hi, I need to return a random number between the series of -10.0 and 35.0. Can i use srand()/rand() for this or should i be using random (as it tells me that srand/rand are obsolete. Does anyone have a good co... atv
what is the best way of passing floats into a string834 (1/20/2007 12:54:19 PM) comp.unix.programmer Hello, I need to pass a float into a string (o_tail->y). I tried doing: o_tail->y=malloc(sizeof(float)+1); snprintf(o_tail->y,sizeof(float)+1,"%f",1.0); I do not null-terminate as snprintf takes care of this (... atv
question on passing adresses/pointers543 (12/21/2006 9:17:57 PM) comp.unix.programmer Hi everyone, A question if you will; I have a function (the load_event function): GLint load_events(GLvoid) { FILE *fp; GLint test_char; events *tmp; /* Open event database for reading */ if((fp=fopen(E... atv
question on passed values and pointer assignments557 (12/19/2006 12:13:26 AM) comp.unix.programmer Why can i do : char *ptr; ptr="test"; should it not be malloced ? and why can i pass a string literal to a function(char *string) does string not need to be malloced as well ? or is this something the com... atv
static char ?652 (12/18/2006 6:21:37 PM) comp.unix.programmer I often see 'static char' defined as a global in some header file. Why is that? As far as i understand it, for example, a static int inside a function retains the value even when the function exits. But seein... atv
proper way to determine string length1854 (12/16/2006 4:43:28 PM) comp.unix.programmer Often i come across a situation where i need to terminate the string. I usually use a construct like: buffer[strlen(buffer)-1]='\0'; And this works fine. But, as i understand it, strlen itself also searches ... alef3(61)
2 questions540 (12/18/2006 12:38:35 AM) comp.unix.programmer 1. Does strdup preserve the '\0' when supplying a string literal like "string". I'm asking this because if that's the case, i can easily write a pointer like that out as fwrite(buffer,strlen(buffer),1,fp). S... alef3(61)
writing this out into file250 (12/18/2006 11:36:54 AM) comp.unix.programmer Ok, as requested, here's a more complete version of what i want to do. I have a struct with a lot of pointers to char, or char arrays. The strings that are being assigned to these are variable. I made all the ... alef3(61)
static char ?652 (12/18/2006 6:21:37 PM) comp.unix.programmer I often see 'static char' defined as a global in some header file. Why is that? As far as i understand it, for example, a static int inside a function retains the value even when the function exits. But seein... alef3(61)
question on passed values and pointer assignments557 (12/19/2006 12:13:26 AM) comp.unix.programmer Why can i do : char *ptr; ptr="test"; should it not be malloced ? and why can i pass a string literal to a function(char *string) does string not need to be malloced as well ? or is this something the com... alef3(61)
question on passing adresses/pointers543 (12/21/2006 9:17:57 PM) comp.unix.programmer Hi everyone, A question if you will; I have a function (the load_event function): GLint load_events(GLvoid) { FILE *fp; GLint test_char; events *tmp; /* Open event database for reading */ if((fp=fopen(E... alef3(61)
Criticisms?15830 (1/19/2007 5:41:55 AM) comp.lang.c Can someone give a detailed rejoinder to this. Would also be nice if someone updates the wiki page so that readers get the other perspective and don't get the wrong impression about C: http://en.wikipedia.org/... netrek(202)
what is the best way of passing floats into a string834 (1/20/2007 12:54:19 PM) comp.unix.programmer Hello, I need to pass a float into a string (o_tail->y). I tried doing: o_tail->y=malloc(sizeof(float)+1); snprintf(o_tail->y,sizeof(float)+1,"%f",1.0); I do not null-terminate as snprintf takes care of this (... alef3(61)
algorithm question #2240 (1/22/2007 10:53:46 PM) comp.unix.programmer Hi, I'm not sure if this is the right newsgroup for this, but maybe someone here has some experience with this kind of thing. I want to size my map according to the objects i have. My map is tiled up in squa... alef3(61)
C is best2325 (4/28/2008 12:26:00 PM) comp.lang.c C is the best because the hackers is most use the C lang ... vgnsh2(1)