C Programming Basics | A blog by Tej Pratap Singh
918 FOLLOWERS
A blog about C programming with examples :keywords,variables, constants, operators, loops, arrays, functions, pointers, structures etc.
C Programming Basics | A blog by Tej Pratap Singh
7M ago
The while loop provides a mechanism to repeat one or more statements while a particular condition is True.
In the while loop, the condition is tested before any of the statements in the body of loop is executed. If the condition is True, only then the statements will be executed otherwise if the condition is False, the control will jump to statement, that is the immediate statement outside the while loop block ..read more
C Programming Basics | A blog by Tej Pratap Singh
9M ago
An algorithm is step by step procedure to solve a particular problem.
Characteristics of an Algorithm :
Inputs: An algorithm has zero or more but only finite number of inputs.
Output: An algorithm has one or more outputs. The requirement of at least one output is obviously essential otherwise we can not know the answer/solution provided by the algorithm.
Finiteness: An algorithm must terminate after a finite number of steps and further each step must be executable in finite amount of time.
Definiteness : Each step of an algorithm must be precisely defined; the action to be carried out mu ..read more
C Programming Basics | A blog by Tej Pratap Singh
9M ago
First Generation
These computers were manufactured using vacuum tubes. These computers used vacuum tubes for circuitry and magnetic drums for memory. These computers were very large and required a lot of space for installation. These were non-portable. As vacuum tubes used filaments, they had a limited life. Because a computer used thousands of vacuum tube, these computers were prone to frequent hardware failure. Hence constant maintenance was required. Since thousands of vacuum tube were used and each vacuum tube consumed half a watt of power, so power consumpt ..read more
C Programming Basics | A blog by Tej Pratap Singh
2y ago
The term computer is derived from the word compute, which means to calculate. A computer is an electronic device that performs diverse operations with the help of instructions to process the data/ information in order to achieve desired results.
Characteristics of Computers Speed :
A computer can process millions of calculations per second. The speed of computation is vary high.
Accuracy :
Besides the efficiency, the computers are also very accurate. The level of accuracy depends on the instructions. Since the computer is capable of doing only what it is instructed to d ..read more
C Programming Basics | A blog by Tej Pratap Singh
2y ago
The round robin scheduling algorithm is designed especially for time sharing systems. It is similar to FCFS, but preemption is added to enable the system to switch between processes. A small unit of time called time quantum is defined.
In this scheduling algorithm, the ready queue is treated as circular queue. New processes are added to the tail of the ready queue. The CPU scheduler picks the first process from the front of ready queue, sets a time to interrupt after one time quantum and dispatches the process. If the burst time of process is less than time quantum, then on the completio ..read more
C Programming Basics | A blog by Tej Pratap Singh
2y ago
History of C language
C is general purpose structured programming language developed in 1972 at Bell laboratories by Dennis Ritchie. Many of the important ideas of C stem from language BCPL, which is developed by Martin Richards. The influence of BCPL on C proceed indirectly through the language B, which was written by Ken Thompson.
In 1983 a committee was formed by American National Standards Institute (ANSI) to standardize the C language. Finally in 1989, the standard for C language was introduced known as ANSI C.
Features of C Language
C provides a variety of d ..read more
C Programming Basics | A blog by Tej Pratap Singh
2y ago
The main objective behind using function is that code duplication in program is avoided and memory space is saved. If a function is called several times the execution speed of program decreases due to passing of control between caller and callee function. By preventing repetitive calls, program execution speed can be increased. The C++ provides a mechanism called inline function.
When a function is declared as inline, the compiler replaces the function call with corresponding function code i.e., function body is inserted in place of function call during compilation. Passing of contr ..read more
C Programming Basics | A blog by Tej Pratap Singh
2y ago
It is possible in C++ to use the same function name for a number of times for different intentions. Defining multiple functions with same name is known as function overloading or function polymorphism. The overloaded function must be different in its argument list and with different data types. The function would perform different operations depending on the argument list in the function call. The correct function to be invoked is determined by checking the number and type of arguments but not on the function type.
If two functions have the similar number of arguments and their&nbs ..read more
C Programming Basics | A blog by Tej Pratap Singh
3y ago
In a ring topology each node is connected to the next node, with the last one connected to the first. A ring topology is sometimes called a loop. Message flow around the ring is in one directional. There is no termination because there is no end to the ring. Each computer or device on the ring topology network acts as a repeater. It transmits data by passing a token around the network. If token is free computer waiting to send takes it, attaches the data and destination address and sends it. when token reaches its destination computer, data is removed. No one computer can monopolise the ..read more
C Programming Basics | A blog by Tej Pratap Singh
3y ago
Array elements can be passed to a function by calling the function by value or by reference.
Call by value : Consider a program-
#include <stdio.h>
void show( int );
int main()
{
int i;
int num [] ={5,6,44,3,8};
for(i=0; i<5; i++)
{
printf(" \n Element %d of array=",(i+1));
show( num[i]);
}
return 0;
}
void show( int x)
{
printf("%d \t", x++);
}
Here we are passing an individual array element at a time to function show ..read more