C Programming

Ace your homework & exams now with Quizwiz!

Divide and Conquer

A divide and conquer algorithm works by recursively breaking down a problem into two or more sub-problems of the same or related type, until these become simple enough to be solved directly.

if statement

Decision making is an important part of programming. Every programming language supports decision making statements allowing programmers to branch according to the condition. In C programming language, if statement is used to check condition and make decision. The decisions or statements are enclosed inside curly braces, however if only a single statement has to be executed, curly braces are not mandatory.

for loop

Looping is a process of repeating a certain group of statements until a specified condition is satisfied. There are three types of loop in C. They are: while loop for loop do-while loop

Dynamic memory allocation (DMA)

Using array in programming, we allocate a fixed size for our data. This size can't be increased or decreased while execution of the program. We can't change it even if the size allocated is more or less than our requirement. This type of allocation of memory is called Static Memory Allocation. This leads to wastage or shortage of memory.

Functions

a logically grouped set of statements that perform a specific task. In C program, a function is created to achieve something. Every C program has at least one function i.e. main() where the execution of the program starts. It is a mandatory function in C.

switch case statement

a multiple branching statement which compares the value of expression or variable inside switch() with various cases provided with the statement and executes a block when a match is found. If no cases inside the switch is matched, the statements inside default block is executed. However, default is optional and may not be present.

Recursion (In C coding)

calling a function by itself is called recursion and the function which calls itself is called recursive function. Recursion is used to solve various mathematical problems by dividing it into smaller problems. This method of solving a problem is called Divide and Conquer.

Nested loop

loop inside another loop is called a nested loop. The depth of nested loop depends on the complexity of a problem. We can have any number of nested loops as required. Consider a nested loop where the outer loop runs n times and consists of another loop inside it. The inner loop runs m times. Then, the total number of times the inner loop runs during the program execution is n*m.

Stack Data

one of the most powerful and most useful concept in programming. It is an ordered collection of items where items can be inserted and deleted from the same end. Only one end of the stack is accessible while the other is restricted.

Arrays

a collection of data of same types stored in sequential memory location. It is a linear data structure, where data is stored linearly one after the other. The elements in an array is accessed using an index. In C, the index of array starts from zero. For example, in an array of n elements, the first element has index zero and the last element has index (n-1). Elements with consecutive index (i.e.


Related study sets

Chapter 2: Stress: The Constant Challenge

View Set

NU471 Week 4 EAQ #3 Evolve Elsevier: Safety - Mastery Level Target: Level 3

View Set

Psychosocial Integrity (HESI Compass Practice Questions)

View Set

Selective and Differential Media

View Set

Patho Final - Ch 43, Patho Final - CH 44, Patho Final - CH 45, Patho Final - Ch 46, Patho Final - Ch 47, Patho Final - Ch 49, Patho Final - CH 48, Patho Final - Ch 52, Patho Final - Ch 51, Patho Final - Ch 50

View Set

QA interview questions + follow up (not priority but better to learn)

View Set

Ch. 1 What Is Organizational Behavior

View Set

Principles of Marketing test 3 (warm ups)

View Set

Texas LT care and partnership policies

View Set