### MC9212 PROBLEM SOLVING PROGRAMMING LECTURE NOTES

Arithmetic Operations on Characters: Consider the following function call: The efficiency of algorithm is directly related to Kartheek D N Asst. Usually macros make the program run faster but increase the program size, whereas functions make the program smaller and compact. In such situations, the memory allocation functions return a NULL pointer. The variables which are defined within the body of the function or block is local to that function or block only and called local variables. There are four storage classes in C:

It may be possible to solve to problem in more than one ways, resulting in more than one algorithm. This variable may be of type int, float, char, array, structure, functions. Thus 3 3 1 gets printed. Thus, an entire line of text can be read and stored in an array. It reads characters into str from the keyboard until a new line character is encountered and then appends a null character to the string.

Consider the following function call: Characters are usually stored in 8 bits 1 byte of internal storage. Unlike signed integers, unsigned integers use all the bits for solvjng magnitude of the number and are always positive. It points to the address of the first element of an array. All keywords must be written in lowercase.

# (DOC) Problem Solving and Computer Programming Notes | Kartheek D N –

Integers are whole numbers with a range of values supported by particular values. Progrzmming is a translator program that converts each high-level program statement into machine code.

250 WORD ESSAY COPYPASTA

Functions Description malloc Allocates the specified number of bytes Syntax: However, the calculation of sum is done in a different function called calsum.

C supports several types of constants as illustrated below: A simple example of if directive is shown below: Entire RAM has been divided into number of equal parts, which are known as memory cells.

There are some things that you cannot do with a switch. It is basically a two-way decision statement and is used in conjunction with an expression.

# CS Problem Solving and Programming – My Lecture In Life

Therefore, if a variable is used at many places in a program it is better to declare its storage class as register. It is the job of the programmer to write the program and then turn into an executable machine language file. C does not provide operators that work directly on strings. In the above program, however, we want to return the sum of x, y and z. Addition of a number to a pointer.

This is usually used to specify the type of functions. If we go through the algorithm, then for all cases, lectre algorithm should terminate after a finite number of steps. Once the problem is well-defined and a method of solving it is developed, then instructing he computer to solve the problem becomes relatively easier task.