Java vs C# (JNNC Technologies)


There are 3 types of data types in C# language.
TypesData Types
Value Data Typeshort, int, char, float, double etc
Reference Data TypeString, Class, Object and Interface
Pointer Data TypePointers

Value Data Type

The value data types are integer-based and floating-point based. C# language supports both signed and unsigned literals.
There are 2 types of value data type in C# language.
1) Predefined Data Types - such as Integer, Boolean, Float, etc.
2) User defined Data Types - such as Structure, Enumerations, etc.
The memory size of data types may change according to 32 or 64 bit operating system.
Let's see the value data types. It size is given according to 32 bit OS.
Data TypesMemory SizeRange
char1 byte-128 to 127
signed char1 byte-128 to 127
unsigned char1 byte0 to 127
short2 byte-32,768 to 32,767
signed short2 byte-32,768 to 32,767
unsigned short2 byte0 to 65,535
int4 byte-2,147,483,648 to -2,147,483,647
signed int4 byte-2,147,483,648 to -2,147,483,647
unsigned int4 byte0 to 4,294,967,295
long8 byte?9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
signed long8 byte?9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long8 byte0 - 18,446,744,073,709,551,615
float4 byte1.5 * 10-45 - 3.4 * 1038, 7-digit precision
double8 byte5.0 * 10-324 - 1.7 * 10308, 15-digit precision
decimal16 byteat least -7.9 * 10?28 - 7.9 * 1028, with at least 28-digit precision

Reference Data Type

The reference data types do not contain the actual data stored in a variable, but they contain a reference to the variables.
If the data is changed by one of the variables, the other variable automatically reflects this change in value.
There are 2 types of reference data type in C# language.
1) Predefined Types - such as Objects, String.
2) User defined Types - such as Classes, Interface.

Pointer Data Type

The pointer in C# language is a variable, it is also known as locator or indicator that points to an address of a value.
CSHRAP Data types 2

Symbols used in pointer

SymbolNameDescription
& (ampersand sign)Address operatorDetermine the address of a variable.
* (asterisk sign)Indirection operatorAccess the value of an address.

Declaring a pointer

The pointer in C# language can be declared using * (asterisk symbol).
  1. int * a;  //pointer to int      
  2. char * c; //pointer to char  

No comments

If you have any doubts,please let me know

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();