File: rogers_example05b.c

package info (click to toggle)
lg-issue39 2-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,408 kB
  • ctags: 145
  • sloc: ansic: 207; perl: 72; makefile: 37; sh: 4
file content (39 lines) | stat: -rw-r--r-- 650 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <stdlib.h>

/*

	This program is written to demonstrate the <stdlib.h> library.

	This program will demonstrate string to number conversions

	Written by James M. Rogers

	17 March 1999

	Released to the Public Domain on this date.

*/

main(){

	double a;
	int b;
	long int c;
	unsigned long int d;


	a = atof("1345");
	printf("%f\n", a);
	b = atoi("-345");
	printf("%d\n", b);
	c = atol("1234567890");
	printf("%d\n", c);
	a = strtod("9876543210.0123456789", (char **)NULL);
	printf("%f\n", a);
	c = strtol("157", (char **)NULL, 10);
	printf("%d\n", c);
	d = strtoul("47586", (char **)NULL, 10);
	printf("%d\n", d);

}