Posts

Showing posts from June, 2020

Algorithm and Flowchart

Image
  Algorithm and Flowchart Algorithm: An algorithm is a set of instructions which when executed accomplish a particular task.   Eg. Algorithm for addition of two numbers. Step 1: Start Step 2: Accept two numbers A and B as input Step 3: perform addition C = A + B Step 4: Print result C. Step 5: Stop                               Flowchart: It is pictorial or graphical representation of algorithm.                                                        Flowchart Notations         Flowchart for addition of two numbers

IDE Commands: For Compiling and Executing C Program

IDE Commands Ø Program written in C language can be run using Command Prompt, we can run using MS-DOS, Nowdays every windows operating system having inbuilt Command Prompt. Ø   We are going to use following tools for running our C program: 1.Window’s Command Prompt and 2.Turbo C/C++ (TC) Compiler. Ø   In order to run C program we must save or copy C program inside bin folder of TC software having path (Eg. C:/TC/bin/Hello.c) otherwise we are not able to run C program. Ø You can create your own directory or folder using following commands. C:\Users\sudam>D: D:\>cd    My Programs D:\My Programs Ø   In above example cd is change directory command as well as change drive command. My Programs is my current changed directory which is created on (D:\ ) drive and it contains my all C Programs. Ø Suppose we have saved  hello.c  program inside “ My Programs”  folder or directory. Ø   Then we can use following command to compile hello.c D:\My Prog...

'C' program Structure : First 'C' Program ''Hello World"

  C program Structure Ø   C program consist of one or more than one functions but main() is the function which must be there in every C Program. Ø   The first function called up during C program execution is main () function. Ø   C program consist of following basic parts or sections 1. C preprocessor Commands 2. Functions (At least main) 3. Variables 4. Statements & Expressions 5. Comments   General Structure of C Program : / / C preprocessor directives section // Global data declaration section main()    //main function {     //Declaration section;        //Program statements; }     // User defined functions funct1() {   …………..   ………….. }                                  ...

What is program Editing/Compiling/Error checking/Executing/Testing/Debugging?

1. Program Editing Ø   For writing the C program source code, you need text editor called as C program editor.Text editor produces   .C(dot c) file as C source program file. Ø   Windows based c editors available along with softwares like Turbo C/C++, Code Blocks with Mingw, Dev C++ with Mingw/GCC. Ø   Xcode available on Mac and Code Blocks with Mingw available on Windows, Linux, and Mac,G-editor (gedit) also available on Linux. 2. Program Compiling Ø   C program source code needs to be compiled by C compiler ,which converts C source code into binary code and then it can be executed or run. Ø   If source code contains errors (or warnings),it will be thrown during compilation process. If source code is error free then it will ready for execution or running. 3. Error Checking Ø   When C program contains error, then as a part of error handler   the global variable errno   will be automatically   assigned   a code(or val...

"C" Compiler

C compiler       Ø   Compiler : A compiler is system software that converts human readable source code into machine readable code which will be executed by CPU. Ø Interpreter : An interpreter is system software that directly executes program source code instructions written in a programming or scripting language, without previously compiling them into a machine language program. Ø   List of some good IDE and Compilers for C 1. Code Blocks with Mingw available on Windows, Linux, and Mac. 2. Dev C++ with Mingw/GCC available on windows.   3.   Xcode available on Mac.   4. Turbo C/C++ available on windows.   5 . GCC/g++: C and CPP compiler for Linux Operating systems.     

History of "C" Programming Language

Process of Programming: Basics History of "C" Programming Language Ø   In the year 1972 the scientist ‘Dennis Ritchie’ developed new programming language, coined as ‘C’.          Ø   The name ‘C’ given because it had superseded the old programming language ‘B’. Ø   Initial goal behind writing C as programming language was to write operating system. Ø   The language was simple, flexible and easy to understand that’s why it became popular programming language.       ‘C’Features :     Fast and Efficient : C programs are fast and efficient one due to variety of data type and powerful operators. Portable:  C is Portable. This means it is platform independent and can run on different platforms with little or no modification in source code. Functions and Rich Libraries: User can write his own function and add in c library. Modularity:  Modularity programming is a software design technique in which software is div...