alt.comp.lang.c
  Home FAQ Contact Sign in
alt.comp.lang.c only
 
Advanced search
April 2008
motuwethfrsasuw
 123456 14
78910111213 15
14151617181920 16
21222324252627 17
282930     18
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
alt.comp.lang.c Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Allocating a pointer?         


Author: saneman
Date: Apr 30, 2008 06:03

In the below code the last call to myprint does not work (gives a
segmentation error).

But I thought that pointer variables local in main (or any other
function) would first be deleted when the calling function returns. Why
does it give a segmentation fault?

#include
#include

void myprint(double* a) {
printf("number is = %%f\n",*a);

}

int main() {

/* Working! (static allocation) */
double d1 = 1.1;
myprint(&d1);

/* Working! (dynamic allocation) */
double* d2 = (double*) malloc(sizeof(double*));
*d2 = 2.2;
myprint(d2);
Show full article (0.72Kb)
29 Comments
  Length of Strings in an Array at compile-time         


Author:
Date: Apr 29, 2008 05:41

How do I find the length of strings within an array at compile time?

The following is not safe:

const char* MyStrings[] =
{
"one",
"two",
"three",
"end marker"
}

#define StringLength(index) MyStrings[index+1] - MyStrings[index]

Since the strings may not be placed consecutively, or in order, within
memory.

Also

#define String1 "one"
#define String2 "two"
#define String3 "three"
Show full article (0.65Kb)
5 Comments
  Floating-Point Constant with Payload         


Author: Jon Sargeant
Date: Apr 19, 2008 22:14

Hi,

I'm looking for a general purpose way of initializing a floating-point
constant with an arbitrary bit pattern using C99. For example,

const unsigned int x=0x3f800000U; //assume 32-bits
const float y=*(float*)&x; //assume 32-bit single-precision IEEE754

Compiling this code on GCC generates the error "initializer element is
not constant". C99 hex floats are a partial solution. I can enter
plus/minus zero, finites, infinites (using 1.0/0.0 and -1.0/0.0), but
NaNs have me stumped. How do I get a constant NaN with a specific
payload? nan() looked promising until I realized that it returns a
variable. Any ideas?

Thanks,
Jon
15 Comments
  726 bloqueador veicular sem mensalidades - http://bloqueadorgsm.vilabol.uol.com.br 7260226878060806336002134         


Author: bloqueador sem mensalidade
Date: Apr 4, 2008 14:49

Bloqueador veícluar com tecnologia gsm - Sem mensalidades

Tenha toda segurança para seu carro com um preço justo.

Apenas R$ 299,00 ( sem mensalidades )

http://bloqueadorgsm.vila.bol.com.br/

Compare e Compre.
Rastreador de Veículo
Rastreadores de Veículos
Rastreador GPS
Rastreadores GPS
Rastreador Ituran
Rastreadores Ituran
Rastreador Portátil
Rastreadores Portáteis.
Assistência 24 Horas

Visite agora mesmo nosso site.

http://bloqueadorgsm.vila.bol.com.br/
Show full article (0.98Kb)
no comments
  86762106 Bloqueador gps gsm - localizador gps gsm - sem mensalidade - alarme automotivo , alarme para carros 867621060487708         


Author: bloqueador sem mensalidade
Date: Apr 1, 2008 16:56

Bloqueador veícluar com tecnologia gsm - Sem mensalidades

Tenha toda segurança para seu carro com um preço justo.

Apenas R$ 299,00 ( sem mensalidades )

http://bloqueadorgsm.vila.bol.com.br/

Compare e Compre.
Rastreador de Veículo
Rastreadores de Veículos
Rastreador GPS
Rastreadores GPS
Rastreador Ituran
Rastreadores Ituran
Rastreador Portátil
Rastreadores Portáteis.
Assistência 24 Horas

Visite agora mesmo nosso site.

http://bloqueadorgsm.vila.bol.com.br/
Show full article (0.93Kb)
no comments