Vaibhavi C# 2310
Vaibhavi C# 2310
Both High level language and low level language are the programming languages’s types. The main
difference between high level language and low level language is that, Programmers can easily
understand or interpret or compile the high level language in comparison of machine.
C is a low-level language that gives developers direct control over memory management and
memory resources, while C# is a higher-level language with object-oriented features and automatic
memory management and garbage collection.
The plan of high-level computer language is to deliver an easy and natural way of giving a program of
commands to a computer.
C# is derived from C programming language, alike to Java, C# is object-oriented, comes with a wide
class library, and chains exception handling, multiple types of polymorphism, and separation of
interfaces from implementations.
The language is proposed for use in developing software components appropriate for deployment in
distributed environments.
Testing frameworks like NUnit11 make C# agreeable to test-driven development, so a good language
for use with Extreme Programming.
C# features with powerful development tools, multi-platform support, and generics, formulate C# a
superior choice for many types of software development projects as below.
C language Features:
C is a simple language in the sense that it provides a structured approach (to break the problem into
parts), the rich set of library functions, data types, etc.
Unlike assembly language, c programs can be executed on different machines with some machine
specific changes. Therefore, C is a machine independent language.
It supports the feature of dynamic memory allocation. In C language, we can free the allocated
memory at any time by calling the free() function.
C++ is a structured programming language. In this we can divide the program into several parts using
functions.
C++ provides a lot of inbuilt functions that make the development fast. Following are the libraries
used in C++ programming are:
C++ provides very efficient management techniques. The various memory management operators
help save the memory and improve the program's efficiency. These operators allocate and deallocate
memory at run time. Some common memory management operators available C++ are new, delete
etc.
C++ programs tend to be compact and run quickly. Hence the compilation and execution time of the
C++ language is fast.
C# language Features:
C# is a simple language in the sense that it provides structured approach (to break the problem into
parts), rich set of library functions, data types etc.
C# programming is based upon the current trend and it is very powerful and simple for building
scalable, interoperable and robust applications.
C# is object oriented programming language. OOPs makes development and maintenance easier
where as in Procedure-oriented programming language it is not easy to manage if code grows as
project size grow.
C# type safe code can only access the memory location that it has permission to execute. Therefore it
improves a security of the program.
Interoperability process enables the C# programs to do almost anything that a native C++ application
can do.
C DataTypes:
void: Represents an empty data type and is often used for functions that do not return a value.
short: Represents short integers. long: Represents long integers. long long: Represents long long
integers.
signed: Indicates a signed integer. unsigned: Indicates an unsigned integer. enum: Represents
enumerated types.
struct: Defines user-defined composite data types. union: Defines a composite data type that can
hold any one of its members.
C++ DataTypes:
void: Represents an empty data type and is often used for functions that do not return a value.
class: Allows you to create user-defined data types through classes and structures.
C++ DataTypes:
C# is a different language from C and C++, but it shares some data types with them. Common data
types in C# include:
Pointers are a fundamental concept in programming languages like C, C++, and other low-level
languages. They allow you to work directly with memory addresses, which can be powerful but also
come with certain risks. Pointers are used for a variety of purposes, including:
Dynamic Memory Allocation: Pointers are commonly used to allocate and deallocate memory
dynamically. For example, in C and C++, you can use malloc() and free() functions to allocate and
release memory using pointers.
Efficient Data Access: Pointers provide a way to access and manipulate data efficiently by working
directly with memory addresses. This is particularly useful for large data structures and arrays.
Function Parameters: Pointers can be used to pass data by reference to functions, allowing a function
to modify the original data directly.
Data Structures: In languages like C and C++, pointers are used to create complex data structures
such as linked lists, trees, and graphs.
Low-Level and Hardware Access: Pointers are essential when you need to interact with hardware or
work with low-level programming, such as device drivers and system programming.
Arrays and Strings: Arrays in C and C++ are essentially a type of pointer that points to the first
element of the array. Strings in C are typically represented as arrays of characters, making use of
pointers for manipulation.
Pointers store memory addresses, allowing you to access the data stored at that location. Here's a
basic overview of how pointers work:
Declaration: To declare a pointer, you use an asterisk (*) before the variable name. For example:
int *ptr;
Initialization: Pointers can be initialized with the memory address of another variable:
int x = 42;
Dereferencing: To access the value at the memory location pointed to by a pointer, you use the
asterisk (*) again. This is known as dereferencing
int value = *ptr; // value is now 42 (the value at the memory location pointed to by ptr)
Arithmetic: You can perform arithmetic operations on pointers. For example, you can increment or
decrement a pointer, which moves it to the next or previous memory location:
Pointer to Functions: Pointers can also be used to store addresses of functions, enabling you to call
functions indirectly.
Pointer Safety: Pointers must be used with caution. Improper use can lead to memory leaks,
segmentation faults, and undefined behavior. It's essential to ensure that pointers are initialized and
used correctly.
Understanding pointers is crucial for low-level programming and for working with languages that
provide more direct control over memory management. However, they also introduce a level of
complexity and potential for errors, so they require careful handling.
C does not supports multiple C++ support multiple C# does not support any
inheritance. inheritance through classes. multiple inheritances through
Means that a class can extend classes.
more than one class at a time.
Pointers are one of the things In C++ pointers can be used In C# pointers can be used only
that make C stand out from anywhere in the program. in unsafe mode.
other programming languages
C language is Est to learn and C++ includes very complex C# is quite easy because it has
very Easy language. features. the well-defined hierarchy of
classes.
C is a structural or procedural C++ is not a pure object- C# is a pure object-oriented
programming language is not oriented programming programming language.
object oriented. language due to the primitive
data types.
C does not have garbage C++ do not support garbage Garbage collection is
collection. collection. supported by C#