DEV Community

Mahamadjon000
Mahamadjon000

Posted on

1

Type Casting

Сегодня расскажу о Type Casting.

Type Casting - Это преобразование в другой тип данных.

Проведение может быть выполнить следущим тип данных.
int => char char => int.

Любой тип данных char можно преоброзавать в int.

Но не все целые числа могут быть char потому что их слишком много.

Пример кода:

#include <iostream>

using namespace std;

int main()
{

int number = 43;
char belgi = number;

cout << number << endl;
cout << belgi << endl;

return 0;
}
Enter fullscreen mode Exit fullscreen mode

Еще есть второй вариант:

cout << int (belgi) << endl;

Top comments (0)

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay