0d: 00h: 00m: 00s

šŸŽ Get 3 extra months of learning — completely FREE

That's 90 extra days to master new skills, build more projects, and land your dream job.

Become a PRO
Background Image

šŸŽ Get 3 extra months of learning completely FREE

Become a PRO
Melvin Simotwo
3 months ago
Melvincountry asked

What are the major data types in C programming?

Saujanya Poudel
Expert
yesterday

In C programming, there are several fundamental data types you can use to declare variables. Here’s a list of the common ones:

  1. int: This is used for storing integers, which are numbers without decimal or fractional parts. For example: int age = 25; Here, age is a variable of type int that stores the value 25.

  2. float: This type is for floating-point numbers, which are numbers with decimal points. For example: float height = 5.9; In this case, height is a float variable holding the value 5.9.

  3. double: Similar to float, but used for double-precision floating-point numbers, which offer more precision. For example: double pi = 3.14159;

  4. char: This is used to store single characters. For example: char grade = 'A';

  5. void: This type is often used for functions that do not return a value, rather than for variables.

Each of these data types serves a different purpose depending on the kind of data you want to store.

If you have more questions about these data types or how to use them, feel free to ask!

C
This question was asked as part of the Learn C Programming course.