C Tutorials
- What is C?
- History Of C?
- Feature of C?
- How to Install C?
- How to write c program?
- First c program
- Flow of C program
- printf() and scanf() in C
- C Program Structure
- Variables in C
- Data Types in C
- Keywords in C
- C Operators
- Comments in C
- Escape Sequence in C
- Escape Sequence in C
- Constants in C
- C - Storage Classes
- C - Decision Making
- Switch statement in C
- C Loops
- Loop Control Statements
- Type Casting in C
- functions in C
- call by value Or call by reference
- Recursion in C
- Storage Classes in C
- Array
- String
- Pointer
- Pointer And Array
- Pointer with function
- Structure
- Union
- File Handling
- Preprocessor Directives
Important Links
How to write c programs?
To write the first c program, open the C console and write the following code:
File name : hello.c or hello.cpp
#include <stdio.h>
int main(){
printf("Hello C Language");
return 0;
}
#include <stdio.h> includes the standard input output library functions. The printf() function is defined in stdio.h .
int main() The main() function is the entry point of every program in c language.
printf() The printf() function is used to print data on the console.
return 0 The return 0 statement, returns execution status to the OS. The 0 value is used for successful execution and 1 for unsuccessful execution.
How to compile and run the c program :-
There are 2 ways to compile and run the c program, by menu and by shortcut.
By menu :-
Now click on the compile menu then compile sub menu to compile the c program.
Then click on the run menu then run sub menu to run the c program.
By shortcut :-
Or, press ctrl+f9 keys compile and run the program directly.
You can view the user screen any time by pressing the alt+f5 keys.
Now press Esc to return to the turbo c++ console.
Compile and Run a C Program :-
Step 1: Locate the TC.exe file and open it. You will find it at location C:\TC\BIN\.
Step 2: File > New (as shown in above picture) and then write your C program
Step 3: Save the program using F2 (OR file > Save), remember the extension should be “.c”. In the below screenshot I have given the name as helloworld.c
Step 4: Compile the program using Alt + F9 OR Compile > Compile
Step 5: Press Ctrl + F9 to Run (or select Run > Run in menu bar ) the C program.
Step 6: Alt+F5 to view the output of the program at the output screen.
Step 2: File > New (as shown in above picture) and then write your C program
#include<stdio.h> int main() { printf("hello World!"); return 0; }
Step 3: Save the program using F2 (OR file > Save), remember the extension should be “.c”. In the below screenshot I have given the name as helloworld.c
Step 4: Compile the program using Alt + F9 OR Compile > Compile
Step 5: Press Ctrl + F9 to Run (or select Run > Run in menu bar ) the C program.
Step 6: Alt+F5 to view the output of the program at the output screen.