C Programming

DATA TYPES AND CONSTANTS
The four basic data types are


Sample program illustrating each data type


	#include < stdio.h >

	main()
	{
		int   sum;
		float money;
		char  letter;
		double pi;

		sum = 10;		/* assign integer value */
		money = 2.21;		/* assign float value */
		letter = 'A';		/* assign character value */
		pi = 2.01E6;		/* assign a double value */

		printf("value of sum = %d\n", sum );
		printf("value of money = %f\n", money );
		printf("value of letter = %c\n", letter );
		printf("value of pi = %e\n", pi );
	}


	Sample program output
	value of sum = 10
	value of money = 2.210000
	value of letter = A
	value of pi = 2.010000e+06


©Copyright B Brown. 1984-1999. All rights reserved.