Lenguaje C

30/07/2003 - 01:19 por Squiur | Informe spam
Disculpen que este mensaje no es de este grupo pero es uno de los mas
concurridos y me pueden ayudar

Estoy realizando un programa en lenguaje y quisiera saber como leer números
enteros largos, porque cuando coloco scanf("%d",&variable) lee muy corto...
al igual que el print("%d")

atte
 

Leer las respuestas

#1 Usuario Sala 1
30/07/2003 - 01:52 | Informe spam
scanf("%ld", &lVariable); //Variable de tipo Long
printf("%ld", lVariable);

Printf & Scanf type specifiers:

'%d'
Matches an optionally signed integer written in decimal.

'%i'
Matches an optionally signed integer in any of the formats that the C
language defines for specifying an integer constant.

'%o'
Matches an unsigned integer written in octal radix.

'%u'
Matches an unsigned integer written in decimal radix.

'%x', '%X'
Matches an unsigned integer written in hexadecimal radix.

'%e', '%f', '%g', '%E', '%G'
Matches an optionally signed floating-point number.

'%s'
Matches a string containing only non-whitespace characters.

'%['
Matches a string of characters that belong to a specified set.

'%c'
Matches a string of one or more characters; the number of characters read is
controlled by the maximum field width given for the conversion.

'%p'
Matches a pointer value in the same implementation-defined format used by
the '%p' output conversion for printf.

'%n'
This conversion doesn't read any characters; it records the number of
characters read so far by this call.

'%%'
This matches a literal '%' character in the input stream. No corresponding
argument is used.

'%h'
Specifies that the argument is a short int * or unsigned short int *.

'%l'
Specifies that the argument is a long int * or unsigned long int *.

'%ll', '%L', '%q'
Specifies that the argument is a long long int * or unsigned long long int
*. (The long long type is an extension supported by the GNU C compiler. For
systems that don't provide extra-long integers, this is the same as long
int.) The `q' modifier is another name for the same thing, which comes from
4.4 BSD; a long long int is sometimes called a "quad" int.

'llu', `Lu'
Specifies that the argument is a unsigned long long int *.

Preguntas similares