KEMBAR78
Nti C and Embedded C Contents | PDF
0% found this document useful (0 votes)
120 views8 pages

Nti C and Embedded C Contents

While loops with non-zero conditions like while(1) or while(2) will result in infinite loops that run continuously until a break statement. While(0) is the opposite and will cause the code block to never execute since the condition is always false. For loops are generally used when the number of iterations is known, while while loops are used for an unknown number of iterations until a certain condition is met.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views8 pages

Nti C and Embedded C Contents

While loops with non-zero conditions like while(1) or while(2) will result in infinite loops that run continuously until a break statement. While(0) is the opposite and will cause the code block to never execute since the condition is always false. For loops are generally used when the number of iterations is known, while while loops are used for an unknown number of iterations until a certain condition is met.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

difference between while and for loop in c .

Difference between while(1) and while(0) in C language

while(1)
It is an infinite loop which will run till a break statement is issued explicitly. Interestingly
not while(1) but any integer which is non-zero will give a similar effect as while(1).
Therefore, while(1), while(2) or while(-255), all will give infinite loop only.
while(0)
It is opposite of while(1). It means condition will always be false and thus code in while
will never get executed.
What is a Data Type in C?

A data type in C refers to the type of data used to store the information. For example, the
name of a person would be an array of characters, while the age will be in integers. Whereas,
the marks of a student would require a data type that can store decimal values.

Type Data types

Basic data types int, char, float, & double

Derived data types array, POINTER, structure, & union

Enumeration data type enum

Void data type void

Type Storage Size Value Range


Int (or signed int) 2 bytes -32,768 to 32,767
unsigned int 2 bytes – 4 bytes 0 to 65,535
Short int (or signed 2 bytes -32,768 to 32,767
short int)
Long (or singed short 4 bytes -2,147,483,648 to 2,147,483,647
int)
unsigned long 4 bytes 0 to 4,294,967,295
float 4 bytes 1.2E-38 to 3.4E+38 (6 decimal places)
double 8 bytes 2.3E-308 to 1.7E+308 (15 decimal places)
Long double 10 bytes 3.4E-4932 to 1.1E+4932 (19 decimal places)
Char (or signed char) 1 byte -128 to 127
unsigned char 1 byte 0 to 255

FOR FURTHER INFO

https://intellipaat.com/blog/tutorial/c-tutorial/c-data-types/?US
what is linker

A linker is an important utility program that takes the object files, produced by the
assembler and compiler, and other code to join them into a single executable
file.

What are Pointers in C

It is a variable which is used to store the address of another variable.

Advantages of pointer

• Return multiple values from function Symbol Name Description

• Access any memory location & address of Determines the address of a


operator variable.
• Improves the performance
* indirection Accesses the value at the
• Reduces the code
operator address.
• Used for dynamic memory allocation.

• Used in arrays, functions and structures.


Difference between Von Neumann and Harvard Architecture

Von Neumann Architecture


Von Neumann Architecture is a digital computer architecture whose design is based on the
concept of stored program computers where program data and instruction data are stored in
the same memory. This architecture was designed by the famous mathematician and
physicist John Von Neumann in 1945.

Harvard Architecture:
Harvard Architecture is the digital computer architecture whose design is based on the concept
where there are separate storage and separate buses (signal path) for instruction and data. It
was basically developed to overcome the bottleneck of Von Neumann Architecture.
Difference between Von Neumann and Harvard Architecture :

VON NEUMANN ARCHITECTURE HARVARD ARCHITECTURE

It is ancient computer architecture based on It is modern computer architecture based on


stored program computer concept. Harvard Mark I relay based model.

Same physical memory address is used for Separate physical memory address is used for
instructions and data. instructions and data.

There is common bus for data and Separate buses are used for transferring data
instruction transfer. and instruction.

Two clock cycles are required to execute


An instruction is executed in a single cycle.
single instruction.

It is cheaper in cost. It is costly than Von Neumann Architecture.

CPU can not access instructions and CPU can access instructions and read/write at
read/write at the same time. the same time.

It is used in personal computers and small It is used in micro controllers and signal
computers. processing.
Difference Between RISC and CISC

S.No. RISC CISC

It stands for Reduced Instruction Set It stands for Complex Instruction Set
1.
Computer. Computer.

It is a microprocessor architecture that This offers hundreds of instructions of


2. uses small instruction set of uniform different sizes to the users.
length.

These simple instructions are executed This architecture has a set of special purpose
3. in one clock cycle. circuits which help execute the instructions at
a high speed.

These chips are relatively simple to These chips are complex to design.
4.
design.

5. They are inexpensive. They are relatively expensive.

Examples of RISC chips include Examples of CISC include Intel architecture,


6.
SPARC, POWER PC. AMD.

7. It has less number of instructions. It has more number of instructions.

It has fixed-length encodings for It has variable-length encodings of


8.
instructions. instructions.

Simple addressing formats are The instructions interact with memory using
9.
supported. complex addressing modes.

It doesn't support arrays. It has a large number of instructions. It


10.
supports arrays.

11. It doesn't use condition codes. Condition codes are used.

Registers are used for procedure The stack is used for procedure arguments
12.
arguments and return addresses. and return addresses.
Binary Search is defined as a searching algorithm used in a sorted array by repeatedly dividing
the search interval in half. The idea of binary search is to use the information that the array is
sorted and reduce the time complexity to O(log N).

difference between if and switch


The if-else statement is used to choose between two options, but the switch case
statement is used to choose between numerous options .
What is debugger
A debugger is a software program used to test and find bugs (errors) in other programs

You might also like