Posts

Introduction of computer 🖥️🖥️🖱️

Image
  Introduction of Computer   In this chapter you will learn about: • Computer • Data processing • Characteristic features of computers • Computers' evolution to their present form Computer • The word computer comes from the word "compute", which means, "to calculate" • Thereby, a computer is an electronic device that can perform arithmetic operations at high speed • A computer is also called a data processor because it can store, process, and retrieve data whenever desired Data Processing The activity of processing data using a computer is called data processing  Data is raw material used as input to data processing and information is processed data obtained as output  Computer Fundamentals: Pradeep K. Sinha & Priti Sinha Characteristics of Computers 1. Automatic : it carries out a job normally without any human intervention.  2. Speed : it can perform several billion (10 ^9) simple arithmetic operations per second . 3. Accuracy : it performs every cal...

Print Greater Number in C

Image
/* Print Greater Number in C */ #include<stdio.h> #include<conio.h> int main() { int num1, num2, num3; printf("Enter 3 numbers");  scanf("%d %d %d", &num1, &num2, &num3); if(num1>num2 && num1>num3) { printf("%d is greater", num1);  }  else if(num2>1 && num2>num3) {  printf("%d is greater", num2);  { else printf("%d is greater", num3); getch() ; }  Output: 

C Storage Classes

Image
    C Storage Classes  A storage class defines the scope (visibility) and life-time of variables and/or functions within a C Program. These specifiers precede the type that they modify. There are the following storage classes, which can be used in a C Program  • auto • register • static • extern The auto Storage Class The auto storage class is the default storage class for all local variables. { int mount;  auto int month;  } The example above defines two variables with the same storage class, auto can only be used within functions, i.e., local variables. The register Storage Class The register storage class is used to define local variables that should be stored in a register instead of RAM. This means that the variable has a maximum size equal to the register size (usually one word) and can't have the unary '&' operator applied to it (as it does not have a memory location).  { register int miles; }   The register should only be used fo...

C Program Structure

Image
          C Program Structure  Let's look into Hello World example using C Programming Language. Before we study basic building blocks of the C programming language, let us look abare minimum C program structure so that we can take it as a reference in upcoming chapters. C Hello World Example A C program basically consists of the following parts: 1. Preprocessor Commands 2. Functions 3. Variables 4. Statements & Expressions 5. Comments Let us look at a simple code that would print the words "Hello World": #include <stdio.h> int main() { /* my first program in C */  printf("Hello, World! \n"); return 0; } Let us look various parts of the above program:   1. The first line of the program #include <stdio.h> is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation. 2. The next line int main() is the main function where program execution begins.  3. The next line /.../ wi...

C Environment Setup

Image
       C Environment Setup  This section describes how to set up your system environment before you start doing your programming wing C language . Before you start doing programming using C programming language, you need the following two softwares available on your computer, (a) Text Editor and (b) The C Compiler. Text Editor This will be used to type your program. Examples of few editors include Windows Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim or vi. Name and version of text editor can vary on different operating systems. For example, Notepad will be used on Windows, and vim or vi can be used on windows as well as Linux or UNIX. The files you create with your editor are called source files and contain program source code. The source files for C programs are typically named with the extension ".c". Before starting your programming, make sure you have one text editor in place and you have enough experience to write a computer program, save it in ...

C Constants and Literals

Image
     C Constants and Literals T he constants refer to fixed values that the program may not alter during its execution. These fixed values are also called literals. Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal. There are also enumeration constants as well. The constants are treated just like regular variables except that their values cannot be modified after their definition. Integer literals An integer literal can be a decimal, octal, or hexadecimal constant. A prefix specifies the base or radix: 0x or OX for hexadecimal, 0 for octal, and nothing for decimal.  An integer literal can also have a suffix that is a combination of U and L, for unsigned and long, respectively. The suffix can be uppercase or lowercase and can be in any order. Here are some examples of integer literals : Floating-point literals A floating-point literal has an integer part, a decimal point, a fraction...

Functions in c++

Image
        Functions in C++ Key Concepts: ➤ Return types in maino ➤ Function prototyping  ➤ Call by reference ➤ Call by value ➤ Return by reference ➤ Inline functions ➤ Default argues  ➤ Constants arguments  ➤ Function overloading  Introduction   We know that functions play an important role in C program development. Dividing a program into functions is one of the major principles of top-down, structured programming. Another advantage of using functions is that it is possible to reduce the size of a program by calling and using them at different places in the program. Recall that we have used a syntax similar to the following in developing C programs. void show();  /*Function declaration */ { show():  /*Function call*/ } void show()   /*Function definition* / .................... ...................      /* Function body* / ................... } When the function is called, control is trausters to the first statemen...