Skip to main content

BASIC C FUNCTIONS || USING BASIC FUNCTIONS IN C || FUNCTIONS OF C-PROGRAMMING LANGUAGE

BASIC FUNCTIONS USED IN C-PROGRAMMING
​=========================================


(​TO WATCH IN VIDEO, CLICK HERE .)


​C-language is basically procedural programming language which highly depends on its functions and its use. Inspite of being case sensitive, C provides us the use of its pre-defined functions according to user choices.

​These functions are pre-defined under their respective header files.

​Before those functions, you should know about the scan formats that are used to input/output to/through a specific datatype.

​SCAN FORMAT          USED FOR

 %d                            Integer type (signed)
​%u                             Integer type(unsigned)
​%ld                            Long Integer type
​%c                              Char type(character by character)
​%s                              Char type(whole string at a time)
​%f                               Float type
​%lf                              Double type
​%Lf                             Long Double type



​SOME OF THE BASIC FUNCTIONS ARE
​==============================

1.) ​printf()

​HEADER FILE : <stdio.h>

​WORK : Prints messages that it contains.

​GENERAL SYNTAX:-
​printf("<MESSAGE OR OUTPUT SCAN FORMATS>");

​EXAMPLE1:-
​           printf("MESSAGE");//outputs messages that are in-between the double inverted commas(" ")
​OUTPUT: MESSAGE

​EXAMPLE2:-
​             int a=10;//variable a of int type initialised to 10
​printf("a= %d",a);
​OUTPUT:- a= 10

​EXAMPLE3:-
​int a=10;
​printf("a= %d",a);
​OUTPUT:- 10

​EXAMPLE4:-
​char c[3]="RAM";
​printf(c);// here c is providing the base address of the variable
​OUTPUT:- RAM



​2.) scanf()

​HEADER FILE : <stdio.h>

​WORK :  Inputs data to the variable assigned.

​GENERAL SYNTAX:-
​           scanf("<scan format> ",&variable_name);//inputs data to variable

​EXAMPLE1:-
​scanf("%d",&a);

​EXAMPLE2:-
​char b[5];//b variable of char type that can store data upto 5 characters
​scanf("%c",&b);

​We can assign multiple scan formats too.
​EXAMPLE3:-
​int a;
​char b[10];
​float c;
​scanf("%d %c %f",&a,&b,&c);


​3.) clrscr()

​HEADER FILE : <conio.h>

​WORK :  Clears the contents that are on the OUTPUT screen.

​GENERAL SYNTAX:-
​           clrscr();

​EXAMPLE:-
​   clrscr();


​4.) getch()

​HEADER FILE : <conio.h>

​WORK :  Inputs the first keystroke from keyboard.

​GENERAL SYNTAX:-
​           getch();//returns ASCII value of the keystroke to the integer type variable

​EXAMPLE:-
​ int a=getch();
​printf("a= %d",a);
​​OUTPUT:- 49 (keystroke from keyboard is 1)


​5.) gotoxy()

​HEADER FILE : <conio.h>

​WORK :  Positions cursor as specified.

​GENERAL SYNTAX:-
​           gotoxy(int x-axis, int y-axis);//positions the cursor coordinates asked accordingly

​EXAMPLE:-
​ printf("ITK");
​gotoxy(20,10);
​printf("ITKNOWLEDGE");


​OUTPUT:-


​Many more functions are there that you will face later on this site.

​                                                          Regards,
​                                                          ITK


Comments

Popular posts from this blog

ASCII TABLE || HEXADECIMAL TABLE

ASCII & Hexadecimal Table (CLICK THE IMAGE TO VIEW IT PROPERLY) REGARDS, ITK

Calculator Using C Programming

  C  is not only capable in maximizing the logical concept towards machine/software programming but it also makes users comfortable through its in-built functions. Making of simple calculator in C must at least be done by the novices themselves to improve and test their level of understandings in logics being applied. Here is the code that has been created for the joy of creativity through C-coding. CODE #include <stdio.h> #include <conio.h> int main() {     int a,b,result;     char ch[2]; clrscr(); gotoxy(30,1);printf("CALCULATOR"); gotoxy(10,8);printf("FIRST NUMBER : "); gotoxy(4,9);printf("OPERATION(+,-,*,/) : "); //to choose operation from gotoxy(9,10);printf("SECOND NUMBER : "); gotoxy(16,12);printf("RESULT : "); gotoxy(30,18);printf("Powered By : ITK"); gotoxy(25,8);scanf("%d",&a); // input first number gotoxy(25,9);scanf("%s",ch); //input operation as a

INSTALLING TURBO C/C++ IN WINDOWS || INSTALLING TURBO C++ || INSTALLING BORLAND'S TURBO C++

Borland's Turbo C/C++ has been making the novices to know the power of coding with interest beside of being outdated since 1987. It was noted for its integrated development environment, small size, fast compile speed, comprehensive manuals and low price availability. But now it's completely free to download and use. You can download Turbo C/C++ of Borland's (according to your PC's requirements) by clicking here. TO SEE THE INSTALLATION VIDEO CLICK HERE . After the download is completed, follow the following steps (picture-wise too) after opening it : 1. Double click the application to start installation. 2. Now click next. 3. Accept the license aggreement to continue to install by clicking intsall button. 4. The installing page will look like - 5. After the installation is completed soon, click read me if you wish to see its license aggreement. 6. Otherwise you can continue by clicking finish. 7. Now go to the desktop and search