Category Archives: General

Dynamic Memmory Allocation

malloc()              The malloc()  function dynamically allocates memory when required. This function allocates ‘size’ byte of memory and returns a pointer to the first byte or NULL if there is some kind of error.The storage is not initialized. For example:               int *ptr = malloc(sizeof(int) * 10);      // allocates 10 ints!                  If it is unable to […]

Union

 Union is a data type with two or more member similar to structure but in this case all the members share a common memory location. The size of the union corresponds to the length of the largest member. Since the member share a common location they have the same starting address.                     The real purpose of unions […]

Graphics

Web page Under construction! The following functions compose the Borland Graphics Interface and are usually available for 16 bit DOS applications. Use them to create onscreen graphics with text. They are defined in graphics.h. #include<stdio.h> #include<conio.h> #include<graphics.h> int main() { int gd=DETECT,gm; initgraph(&gd;,&gm;,”f:\\tc\\bgi”); getch(); closegraph(); /* closes down the graphics system */ return 0; } […]

Goto statement

The goto statement is used to alter the normal sequence of program execution by transferring control to some other part of the program unconditionally. In its general form, the goto statement is written as goto label;                    where the label is an identifier that is used to label the target statement to which the control […]

String

                          A string in C is actually a character array. As an individual character variable can store only one character, we need an array of characters to store strings. Thus, in C string is stored in an array of characters. Each character in a string occupies one location in an array. The null character ‘\0’ […]

IO Functions

The usually used input statement is scanf () function. Syntax of scanf function is                  scanf (“format string”, argument list);                 The format string must be a text enclosed in double quotes. It contains the information for interpreting the entire data for connecting it into internal representation in memory.Example: integer (%d) , float (%f) , character […]

Sourcecode

1.check prime numbers source code #include #include void main() { int l,i,j,f,n; clrscr(); do { printf(“\n[1] to check prime number\n”); printf(“[2] to generate prime numbers upto a given number\n”); printf(“[3] to exit\nEnter yor choice\n”); scanf(“%d”,&l;); switch(l) { case 1: { printf(“enter a number\n”); scanf(“%d”,&n;); f=1; for(i=2;i 2.Matrix operation #include #include void input(int z); void multiply(void); […]