Math, asked by PrabhudattaSingh, 1 year ago

difference between implict and explict type data conversion​

Answers

Answered by Anonymous
2

❗❕The basic difference between implicit and explicit type casting is that implicit is taken care of by the compiler itself, while explicit is done by the programmer. ... In the above statement, the conversion of data from int to double is done implicitly, in other words programmer don't need to specify any type operators.❗❕

#HOPE IT HELPS YOU ♥❤♠⭐✨✌

#GO_π_FOLLOW_ME⏪⏬⏫⏩⤵⤴

Answered by anju94406
0

Answer:

Tutorialspoint

Search your favorite tutorials...

What is the difference between implicit and explicit type conversion in C#?

CsharpProgrammingServer Side Programming

Follow Answer 859

1 Answer

Samual Sam

Samual Sam

Answered on 14th Aug, 2018

The following is the difference between implicit and explicit type conversion −

Implicit Type Conversion

These conversions are performed by C# in a type-safe manner.

To understand the concept, let us implicitly convert int to long.

int val1 = 11000;

int val2 = 35600;

long sum;

sum = val1 + val2;

Above, we have two integer variable and when we sum it in a long variable, it won’t show an error. Since the compiler does the implicit conversion on its own.

Let us print the values now.

Example

using System;

using System.IO;

namespace Demo {

class Program {

static void Main(string[] args) {

int val1 =34567;

int val2 =56743;

long sum;

sum = val1 + val2;

Console.WriteLine("Sum= " + sum);

Console.ReadLine();

}

}

}

Explicit Type Conversion

These conversions are done explicitly by users using the pre-defined functions.

Let us see an example to typecast double to int −

Example

using System;

namespace Program {

class Demo {

static void Main(string[] args) {

double d = 1234.89;

int i;

// cast double to int.

i = (int)d;

Console.WriteLine(i);

Console.ReadKey();

}

}

}

Step-by-step explanation:

mark as brain list answer

and

follow me

Similar questions