C programming variable types size_t unsigned type storing the sizes of objects in bytes time_t store results of the time() function clock_t store results of the clock() function FILE accessing a stream (usually a file or device) ptrdiff_t div_t ldiv_t fpos_t va_list wchar_t sig_atomic_t Jmp_buf

Files Recovery Software
Home Contact Details Customer Support Download Demo Products  

 
 

Special-purpose types commonly used:

Variable Type

Description

size_t

unsigned type used for storing the sizes of objects in bytes

time_t

used to store results of the time() function

clock_t

used to store results of the clock() function

FILE

used for accessing a stream (usually a file or device)

ptrdiff_t

signed type of the difference between 2 pointers

div_t

used to store results of the div() function

ldiv_t

used to store results of ldiv() function

fpos_t

used to hold file position information

va_list

used in variable argument handling

wchar_t

wide character type (used for extended character sets)

sig_atomic_t

used in signal handlers

Jmp_buf

used for non-local jumps


To better understand these variables let us take an example:

/* Program to tell the range and size in bytes of the C variable */

#include <stdio.h>

int main()
{
int a; /* simple integer type */
long int b; /* long integer type */
short int c; /* short integer type */
unsigned int d; /* unsigned integer type */
char e; /* character type */
float f; /* floating point type */
double g; /* double precision floating point */

a = 1023;
b = 2222;
c = 123;
d = 1234;
e = 'X';
f = 3.14159;
g = 3.1415926535898;

printf( "\nA char is %d bytes", sizeof( char ));
printf( "\nAn int is %d bytes", sizeof( int ));
printf( "\nA short is %d bytes", sizeof( short ));
printf( "\nA long is %d bytes", sizeof( long ));

printf( "\nAn unsigned char is %d bytes", sizeof( unsigned char ));

printf( "\nAn unsigned int is %d bytes", sizeof( unsigned int ));

printf( "\nAn unsigned short is %d bytes", sizeof( unsigned short ));

printf( "\nAn unsigned long is %d bytes", sizeof( unsigned long ));

printf( "\nA float is %d bytes", sizeof( float ));

printf( "\nA double is %d bytes\n", sizeof( double ));

printf("a = %d\n", a); /* decimal output */
printf("a = %o\n", a); /* octal output */
printf("a = %x\n", a); /* hexadecimal output */
printf("b = %ld\n", b); /* decimal long output */
printf("c = %d\n", c); /* decimal short output */
printf("d = %u\n", d); /* unsigned output */
printf("e = %c\n", e); /* character output */
printf("f = %f\n", f); /* floating output */
printf("g = %f\n", g); /* double float output */

printf("\n");

printf("a = %d\n", a); /* simple int output */
printf("a = %7d\n", a); /* use a field width of 7 */
printf("a = %-7d\n", a); /* left justify in field of 7 */

c = 5;
d = 8;

printf("a = %*d\n", c, a); /* use a field width of 5*/
printf("a = %*d\n", d, a); /* use a field width of 8 */

printf("\n");

printf("f = %f\n", f); /* simple float output */
printf("f = %12f\n", f); /* use field width of 12 */
printf("f = %12.3f\n", f); /* use 3 decimal places */
printf("f = %12.5f\n", f); /* use 5 decimal places */
printf("f = %-12.5f\n", f); /* left justify in field */

return 0;
}

Previous page

page 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20

 
 

page 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37

 
 

page 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54

 
 

page 55 | 56 | 57 | 58 | 59 | 60

Next page
 
 
Data Recovery Book
 
Chapter 1 An Overview of Data Recovery
Chapter 2 Introduction of Hard Disks
Chapter 3 Logical Approach to Disks and OS
Chapter 4 Number Systems
Chapter 5 Introduction of C Programming
Chapter 6 Introduction to Computer Basics
Chapter 7 Necessary DOS Commands
Chapter 8 Disk-BIOS Functions and Interrupts Handling With C
Chapter 9 Handling Large Hard Disks
Chapter 10 Data Recovery From Corrupted Floppy
Chapter 11 Making Backups
Chapter 12 Reading and Modifying MBR with Programming
Chapter 13 Reading and Modifying DBR with Programming
Chapter 14 Programming for “Raw File” Recovery
Chapter 15 Programming for Data Wipers
Chapter 16 Developing more Utilities for Disks
Appendix Glossary of Data Recovery Terms
 
 
Pro Data Doctor

Home

Products

Contact Details

Customer Support

Download Demo

Terms and Conditions

 
Pro Data Doctor