iForeRunner
 
   
 
  c  
   
   
   
 
  ENTERIN INTO C  
 
 



Structure of a 'C' Program




ENTERING INTO 'C'

You have to go to Dos prompt and at the c:\> you have to change the directory to turboc2 and give 'tc' command. This will take you to the editor where you can write a C program. printf():- This is a function which is used to display the messages on the screen and also used to display the values in the variables using the respective format specifiers.

Syntax: printf( "control string ", arguments);

Eg: printf("Hello");

printf("The value is %d", a);
scanf():- It is used to accept the values through the keyboard during run time.
Syntax:- scanf("control string", arguments);
Eg: scanf("%d%d",&a,&b);
Here in scanf(), you should not use any spaces or special characters in the middle of format specifiers. The '&' symbol here is known as address of operator and the value we accept is stored in the address of the variable. After writing a C program in editor, you have to save the file, by default, file will be noname.c and it is renamed with the file name you give i.e for example 'my_file', by saving it. After saving a file, you have to compile it, by pressing Alt+F9 or using compile option from compile menu. It will convert all the source program(user program) into object code (machine language) and gives the errors if present any in the program. While compiling it, it creates a file with the extension .obj with the same name as the filename. After removing the errors finally, it will create an executable file with the same name as the file and with extension as .exe. To get the output of the program to have written, you have to run the file. This you can do by pressing, Ctrl+F9 or using 'run' option from 'run' menu. After executing the file, you are again brought back to the program. To see the result of your program, you have to press Alt+F5 to go to user screen. If you give a getch() command at the end of program before the ending brace, there is no need for you to use Alt+F5. Using the executable file, you can run your program from the dos prompt also even if you don't have .c and .obj files. Along with these 3 files, you will get another file, which will contain the source program and with the extension .bak and with the same name as the file name. This file is known as backup file. Even you by mistake delete the source file, still you can get it by using this backup file.


Please send comments to vgdarur.javafive@blogger.com