C Programming.

1. Computer Programming 2. History of Prog.Language 3. Introduction to C 4. Features of C 5. Starting Turbo C 6. C Tokens 7. Basic requirement of C 8. Comments 9. My First Program in C 10. Line Break 11. C Escape Sequence 12. Constants or Literals 13. Variables in C 14. Data Types in C 15. Range of Data Types in C 16. Declare Variables 17. Reserved Key Words 18. printf( ) statement 19. Chained & Embedded state 20. Prog.to print sum of 2 nos 21. scanf( ) stament 22. print sum & average 23. print Area of Rectangle 24. Area & Circumference of Circle 25. Prg.for Simple Calculator 26. Operators in C 27. Ex. Of Operators 28. Swap two numbers 29. Hierarchy of Operators 30. if( ) statement 31. Prg.to check +ve,-ve or zero 32. if..else statement 33. Prg.to check Odd or Even 34. Prg.to print larger of 2 nos 35. Prg.to print largest of 3 nos 36. Prg.to check divisibility 37. Prg.to check print range 38. for. . . loop statement 39. prg.to print series of nos 40. Prg.to check divisibility 41. prg.to print sum of nos 42. Prg.to print Pyramid 43. prg.for Factorial 44. prg.to fill screen 45. prg.for largest/smallest no 46. prg.to print reverse no 47. prg.to add each digit 48. prg.for sum of factorial 49. prg.for fibonacci series 50. prg.to check Prime nos 51. prg. Prime no from 1 to 100 52. prg.Specified Prime nos 53. while( ) statement 54. do. . While statement 55. goto statement 56. break & continue state. 57. switch case statement 58. Array in C 59. Reverse order using array 60. Ascending/Descending order 61. prg.to search no in Array 62. Double Dimension Array 63. String in C 64. String with spaces in C 65. Print string in reverse 66. prg.to count A,E,I,O,U vowel 67. Function( ) in C 68. Function program examples 69. General Purpose Programs 70. Loan & EMI calculation prg. 71. Table print prg. 72. Leap year program 73. lower to UPPER case prg. 74. Frequency Distribution prg. 75. Bank note calculation prg. 76. Simple Interest prg. 77. Compound Interest prg. 78. Simple Depreciation prg. 79. Reducing bal.Depreciation 80. Marksheet prg. 81. Income Tax prg. 82. Time calculator prg. 83. Distance converter prg. 84. Volume Air Calculation 85. Time to fill Water Tank 86. Salary Calculation prg. 87. Total Sale Calculation prg. 88. Male/Female percentage prg. 89. Library Rent prg. 90. Office Expance prg. 91. Total Salary Calculation prg. 92. Profit or Loss prg. 93. Total Profit/Loss prg. 94. Convert Amt to Word. 95. ASCII Table 96. C Operators 97. C & C++ Reserved Keyword 98. C & C++ Pre-Define Function 99. C Interview Part1 100. C Interview Part2 101. C Interview Part3 102. C Interview Part4 103. C Interview Part5 104. C Interview Part6 105. C Interview Part7 106. C Interview Part8 107. C Interview Part9 108. C Interview Part10 109. C Interview Part11
Pr.Pg Next Pg

C and C++ Pre-Defined Functions tutorials

Function

Type

Prototype and Description

Header File

abort ( )

 

void abort ( );

Aborts the program

<stdlib.h>

abs ( )

int

int abs ( int n;)

Return the absolute value o f n

<stdlib.h>

acos ( )

double

double acos (double x);

Returns the inverse cosine (arcsine) of x

<math.h>

asin ( )

double

double asin (double x);

Returns the inverse tangent (arctangent) of x

<math.h>

atan ( )

double

double atan (double x )

Returns th e inverse tangent (arctangent)of x

<math.h>

atof ( )

double

double atof (const char* s);

Returns the floating-poinmt number represented literally in the string s

<stdlib.h>

atoi ( )

int

int atoi (const char * s);

Returns the integer represented literally in the string s.

<stdlib.h>

atol ( )

long

long atol (const char* s);

Return the integer represended literally in the string s.

<stdlib.h>

bad ( )

 

int ios : :bad ( );

Returns nonzero if badbit is set;returns 0 otherwise

<iostream.h>

bsearch ( )

 

void* bsearch (const void* x, void* a

size_t n,

size_t s,

int (*cmp)

(const void*,const void*));

Implementation the binary search algorithm to search for x in the sorted array a of n elements each of size s using the function *cmp to compare any two such elements. If found a pointer to the element is returned; otherwise, the NULL pointer is returned.

<stdlib.h>

ceil ( )

double

Double ceil (double x );

Returns x rounded upto the next whole number.

<math.h>

clear ( )

 

void ios : :clear (int n=0);

Changes stream state to n.

<iostream.h>

 

 

Void clearer (FIFLE* P)

Clears the end of life and error flags for the file *p

<stdio.h>

close ( )

 

void fstreambase : : close ( );

closes the file attatched to the owner object

<fstream.h>

cos ( )

double

double cos (double x);

Returns the inverse cosine of x.

<math.h>

cosh ( )

double

Double cosh (double x);

Returns the hyperbolic cosine of x: (ex+e-x)/2.

<math.h>

difftime ( )

double

double difftime (time_t t1,time_t t0);

Returns time elapsed (in seconds) from time t0 to time t1.

<math.h>

eof ( )

 

int ios : :eof ( );

Returns nonzero if eofbit is set: returns 0 otherwise

<iostream.h>

exit ( )

void

void exit( int n);

Terminates the program and returns n to thr invoking process.

<stdlib.h>

 

exp ( )

double

double exp (double x);

Returns the exponential of x: ex.

<math.h>

fabs ( )

double

double fabs (double x);

Returns the absolute value of x.

<math.h>

fail ( )

 

int ios : :fail ( );

Return nonzero if failbit is set; returns 0 otherwise.

<iostream.h>

fclose ( )

int

int fclose (FILE* p);

Close the file *p and flushes all buffers. Returns 0 if successful;

returns EOF otherwise.

<stdio.h>

fgetc ( )

int

char*fgets(char*s, int n, File*p);

Read the next line from the file *p and stores int in it *s.The “next line” means either the next n-1 characters or all the characters up to the next endline character,whichever comes first. The NUL character is appended the characters stored in s.Returns s if successful; return NULL otherwise

<stdio.h>

fill ( )

 

char ios : : fill ( );

Return the current fill character.

char ios : : fill (char c);

Changes the current fill character to c and returns the previous fill character.

<iostream.h>

flags ( )

 

long ios : : flags ( );

Returns the current fill character.

long ios flags (long n);

Changes the current format flags to n; returns the previous flags.

<iostream.h>

floor ( )

double

double floor (double x);

Return x rounded down to the next whole number.

<math.h>

flush ( )

 

Ostream & ostream : : flush ( );

Flushes the output buffer and returns the updates stream.

<iostream.h>

fopen ( )

file*

FILE* fopen(const char* p, const char* s);

Opens the file *p and returns the address of the structure that represents the file if successful; returns NULL otherwise.The string s determines the file’s mode: “r” for read, “w” for write “a” for append, “r+” for reading and writing an existing file, and “a+” for reading and appending an existing file.

<stdio.h>

fprintf ( )

int

int fprintf (FILE *p, const char* s, … );

Writes formatted output to the file *p. Returns the number character printed if successful; otherwise it returns a negative number.

<stdio.h>

fputc ( )

int

int fputc ( int c, FILE *p);

Writes character c to the file *p. Returns a character written or EOF if unsuccessful.

<stdio.h>

 

fputs ( )

int

int fputs (const char *s, FILE *p);

Write string s to the file *p. Returns a nonnegative integer if successful; otherwise it returns EOF

<stdio.h>

 

fread ( )

int

size_t fread ( void*s, size_t k, size_t n, FILE* p);

Reads up to n items each of size k from the file *p and stores them at location s in memory. Returns the number of items read.

<stdio.h>

 

fscanf ( )

int

int fsacnf ( FILE* p, const char * s, … );

Reads formatted input from the file *p and stores them at location s in memory. Returns EOF if end of file is reached; otherwise it returns the number of items read into the memory.

<stdio.h>

 

fseek ( )

int

int fseek ( FILE* p, long k, int base);

Repositions the positions marker of the file * p k bytes from its base, where base should be SEEK_SET for the beginning of the file, SEEK_CUR fo the current positions of the file marker, or SEEK_END for the end of the file. Returns 0 if successful.

<stdio.h>

 

ftell ( )

long int

long ftell ( FILE *p);

Returns the location of the position marker in file *p or returns -1.

<stdio.h>

 

fwrite ( )

int

size_t fwrite (void*s, size_t k, size_t n, FILE* p);

Writes n items each of size k to the file *p and returns the number written.

<stdio.h>

 

gcount ( )

 

int stream : : gcount ( );

Returns the number of characters most recently read.

<iostream.h>

get ( )

 

int istream : :get ( );

istream & istream : : get (signed char & c);

istream & istream : : get (unsigned char &c);

istream & istream : : get (signed char* b,int n, char e = ’\n’);

istream & istream : : get (unsigned char* b, int n, char e = ‘\n’);

Reads the next character c from the istream. The first version returns c or EOF. The last two versions read upto n characters into n characters into b, stopping when e is encountered.

<iostream.h>

getc ( )

int

int getc (FILE* p );

Same as fgetc ( ) except implemented as a macro.

<stdio.h>

getchar ( )

int

int getchar ( );

Returns the next character from the standard input or returns EOF.

<stdio.h>

gets ( )

char*

char* gets(char* s);

Read next line from standard input and stores it in s. Returns s or NULL if no characters are read.

<stdio.h>

good ( )

 

int ios : : ()’

Returns nonzero if stream state is zero;returns zero otherwise.

<iostream.h>

ignore ( )

 

Istream & ignore (int n=1, int e = EOF);

Extracts up to n characters from stream, or up to the character e, whichever comes first. Returns the stream.

<iostream.h>

isalnum ( )

int

int isalnum (int c);

Returns nonzero if c is an alphabetic or numeric character; returns0 otherwise.

<ctype.h>

isalpha ( )

int

int isalpha (int c);

Returns nonzero if c is an alphabetic character or returns0.

<ctype.h>

iscntrl ( )

int

int iscntrl (int c);

Returns nonzero if c is a control character; otherwise returns0

<ctype.h>

isdigit ( )

int

int isdigit (int c);

Returns nonzero if c is any non blank printing character; otherwise returns0

<ctype.h>

isprint ( )

int

int islower (int c);

Returns nonzero if c is any printing character; otherwise returns0.

<ctype.h>

 

ispunct ( )

int

int ispunct (int c);

Returns nonzero if c is any punctuation mark,except the alphabetic characters, the numberic characters and the blank; otherwise returns 0.

<ctype.h>

isspace ( )

int

int isspace (int c);

Returns nonzero if c is any white space character,including the blank ‘ ‘;the form feed ’\f’, the newline ‘\n’, the carriage return ‘\r’, the horizontal tab ‘\t’, and the vertical tab ;\v’;

Otherwise returns 0;

<ctype.h>

isupper

int

int isupper (int c);

Returns nonzero if c is an uppercase alphabetic character; otherwise return 0;

<ctype.h>

isxdigit ( )

int

int isdigit (int c);

Returns nonzero if c is one of the digit characters or one of the 12 hexadecimal digit letters: ‘a’, ; ‘b’, ‘c’, ‘d’, ‘e’, ‘f’,.

‘A’, ‘B’, ‘C’, ‘D’, ‘E’, or ‘F’ ;otherwise returns 0.

<ctype.h>

labs ( )

long labs

long labs (long n);

Return absolute value of n.

<ctype.h>

log ( )

double

double log (double x);

Return the natural logarithm (base e) of x.

<math. h>

log10 ( )

double

double log10 (double x);

Returns the common logarithm (base 10) of x.

<math. h>

membchr ( )

 

void* memchr(const void* s, int c, size_t k);

Searches the k bytes of memory beginning at s for character c. If found, the address of its first occurrence is returned.Returns NULL otherwise.

<string.h>

memcmp ( )

 

int memchp (const void* s1, const void* s2,size_t k);

Compares the k bytes of of memory beginning at s1 with k bytes of memory beginning at s2 and returns a negative , zero or a positive. integer according whether the first string is lexicographically less than, equal to, or greater than the second string.

<string.h>

memcpy ( )

 

void* memcmp (const void* s1, const void* s2, size_t k);

Copies the k bytes of memory beginning at s2 into memory beginning at s2 into memory location s1 and returns s1

<string.h>

Memmove ( )

 

int mmemove (const void* s1, const s2, size_t k);

same as memcpy ( ) except strings may overlap.

<string.h>

open ( )

 

void fstream : : open (const char* f, int m,

int p=filebuf : :openprot);

void ifstream : : open (const char* f,

int m = ios : :in,

int p = filebuf :: openprot);

void ofstrem : : open ( const char* f,

int m =ios : : out,

int p=filebuf : :openprot);

void ofstream : : open ( const char* f,

int m=ios: : out,

int p=filebuf : : openprot);

Opens the file f in mode m with protection p.

<fstream.h>

peek ( )

 

int istream : : peek ( );

Returns next character (or EOF)from stream without extracting it.

<iostream.h>

pow ( )

double

double pow (double x, doub;e y);

Returns x raised to the power y (xy).

<math.h>

precision ( )

 

int ios : : precision ( );

int ios : : precision (int k);

Returns the current precision for the stream.The second version changes the current precision to k and returns the old precision.

<iostream.h>

 

tolower ( )

int

int tolower (int c);

Returns the lowercase version of c if c is uppercase alphabetic character; otherwise returns c.

<ctype.h>

toupper ( )

int

int toupper (int c);

Return the uppercase version of c if c is a lowercase alphabetic character; otherwise returns c.

<ctype.h>

 

Pr.Pg border                                              Next Pg