answersLogoWhite

0

The main difference is that int values are treated as being integers whereas char values are treated as being character codes. Thus if you output a char with value 65 you will get the symbol 'A', but if you output an int with the value 65 you will get the value 65 instead. In order to output the symbol 'A' you would have to cast the int to a char.

User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

What is explicit typecasting in C plus plus programming?

int i = 42; char c = ( char ) i; // explicit cast double d = i; // implicit cast


Sample programs in c plus plus language using pointers?

#include int main (int argc, char **argv){int i;for (i=0; i


What is earlier declaration for main?

pick one: int main (void); int main (int argc, char **argv); int main (int argc, char **argv, char **envp);


How do you create functions with multiple parameters in C plus plus?

Random example, function with two parameters: int main (int argc, char **argv) {...}


Integers need how many bits to stored in C plus plus?

It depends on the type of integer (such as long, short, int and char) and the specific implementation of C++. The only guarantee is that a char must occupy one byte (sizeof(char)==1). An int is typically 32-bits (4 bytes), but only sizeof(int) can tell you for sure.


What is a primitive type variable in c plus plus?

same the types used in C. that is int...char...float...


Use of int in C plus plus?

Is quite common. Example: int main (int argc, char **argv) { printf ("Number of parameters is %d\n", argc-1); return 0; }


How do you convert a char to and int in c plus plus but keep the value of the char so if the char was 3 the int would also be 3?

Formally, you cannot do this. A char containing a character value has a different bit configuration than an int. Attempting to convert between the two is non-portable. However, in the ASCII character set, the character '0' has the value 48, or 0x30. If you subtract 48 from the char you will get the int value, but only if the char was one of the digits '0' through '9'. It is better to use the library routines to convert, such as atoi and sscanf, because they will give you predictable, portable results.


Types of main function in C programming?

minimalist: int main (void); standard: int main (int argc, char **argv); unix-only: int main (int argc, char **argv, char **envp);


What is the prototype of printf function?

in stdio.h:extern int printf (const char *fmt, ...);


What are the four integral types in C plus plus?

There are far more than 4 integral types in C++. As of C++11, there were 27 integral types: bool char signed char unsigned char wchar_t char16_t char32_t short signed short unsigned short short int signed short int unsigned short int int signed int unsigned int long signed long unsigned long long int signed long int unsigned long int long long signed long long unsigned long long long long int signed long long int unsigned long long int


Can you use blank lines in your C plus plus Code?

Yes, for example: #include <stdio.h> int main ( int argc, char **argv) {puts ("Hello, world"); return 0; }