answersLogoWhite

0

long, short, char and bool are 4 valid variable types. There are many more available, including (but not limited to) float, double, int, wchar_t, size_t, as well as compound types (such as long long) and unsigned/signed variations, such as unsigned int. All of these types are primitive, integral or built-in data types. More complex data types can be formed from struct, class and union declarations, but they all simply build upon the integral types.

User Avatar

Wiki User

11y ago

What else can I help you with?

Continue Learning about Engineering

Is special symbols are valid as a string in java?

Yes. Any special character inside the String is considered as part of the string variable and would not be treated as a special character. Ex: String str = "ABC_$4"; is a valid string declaration


What is a valid variable data type?

1. If its natural or integer numbers- Integer(Int) data type. 2. If it consists of decimal or fraction part- Double or float data type. 3. If it has a single letter or sign- Character(Char) data type. 4. If its got many words(alpha-numerical)- String data type. 5. If the result has to be "true" or "false"- Boolean data type.


How to wite the codes in C plus plus enter 4 integers?

#include<iostream> int main() { int n[4]; std::cout << "Enter 4 integers: " std::cin >> n[0] >> n[1] >> n[2] >> n[3]; } The above is naive because there's no error-checking to prevent garbage input. A better solution is to input 4 strings and then convert those strings to integers. If the conversion fails, simply ask for new input until the conversion succeeds. The following shows one method of achieving this: #include<iostream> #include<sstream> int main() { int n[4]; // repeat until valid bool valid {false}; while (!valid) { // create 4 temporary strings for input std::string s[4]; std::cout << "Enter 4 integers: " std::cin >> s[0] >> s[1] >> s[2] >> s[3]; // assume input is valid until proven otherwise valid = true; for (size_t i=0; valid && i<4; ++i) { // convert the current string to an integer std::stringstream ss {s[i]}; valid = (ss >> n[i]); } } // When we reach here, n[] will contain 4 valid integers. // Use n[] ... }


How many tokens are present in C?

There are 6 types of Tokens in C which are as follows:- 1. Keyword 2. Identifier 3. Constants/Literals 4. Variable 5. Operator 6. Punctuator


What is the function in java to find the size of given variable?

Dependion on the variable there are several methods to do it, this can only be applied to primitive types and arrays, for an array its the "name_of_array.length", for the arraylist this change just a little, it would be like "name_of_array_list.size()", for an int, double, float, long, byte, it would be like "name_of_variable.LENGTH" this is a public variable so you dont need a get, an finally for the String there is a method "name_of_string.length()" this would return the size of this String