start with a simple program in C....
#include<conio.h>
#include<stdio.h>void main(){
clrscr();
printf("welcome to my blog");
}
I assumed that you are working on TC ide.so first we will compile program either by pressing keys Alt+F9 or by clicking 'compile' given in menu on the center of top.Compilation of source code will generate it's machine code
Compiler can catch only syntax errors.It can not catch 'run time' errors.
Syntax errors are related to rules of programming languages defined by C developer.
If program has been compiled without any error(syntax) with or without any warning you can run(execute) your program bye pressing either Ctrl+F5 or from menu(click run).
After being run, console window will be disappear within fraction of second. So to make console in pause, we use other functions like 'getch( )' or 'getche( )'.The only difference b/w these function is that the function getch( ) leaves console without any change on it but getche( ) echos the letter on console to which we pressed in pause condition.
so the new code will be like
include<conio.h>
#include<stdio.h>void main(){
clrscr();
printf("welcome to my blog");
getch();
}
No comments:
Post a Comment