Académique Documents
Professionnel Documents
Culture Documents
function
Arguments are used mostly in functions (or methods). Basically it can be any input parameter(s) which a function(s) can use to do it's work. For instance, sin(x) sinus is a function and x is it's argument.
The mechanism used to convey information to the function is the argument. You have unknowingly used the arguments in the printf( ) and scanf( ) functions; the format string and the list of variables used inside the parentheses in these functions are arguments. The arguments are sometimes also called parameters. Short char The only valid modifier for char data type in C/C++ is signed and unsigned; short and long modifiers are only used for integer data type int. The primitive integral types in C/C++ are: char and int:
char c; // safe range 0~127 (because depending on the compiler settings, it is either -128~127 or 0~255) int i; // range -32768 ~ 32767 (16 bit) or -2147483648 ~ 2147483647 (32 bit) Using signed/unsigned and short/long modifiers, the set of integral data types would be: char c; // safe range 0~127 signed char sc; // -128~127 unsigned char uc; // 0~255 int i; // range -32768 ~ 32767 (16 bit) or -2147483648 ~ 2147483647 (32 bit) signed int si; // exactly the same as int. unsigned int ui; // 0~65535 or 0~4294967295 signed si1; // the same as signed int unsigned ui1; // the same as unsigned int short int s; // range -32768~32767 long int l; // -2147483648 ~ 2147483647 short s1; // the same as short int long l1; // the same as long int unsigned short int usi; // 0~65535 (may be abbreviated to unsigned short) unsigned long int uli; // 0~4294967295 (may be abbreviated to unsigned long).
A single character can be defined as a character(char) type data. Characters are usually stored in 8 bits (one byte) of internal storage. The qualifier signed or unsigned may be explicitly applied to char. While unsigned chars have values between 0 and 255, signed chars have values from 128 to 127. A character constant is formed by enclosing the character within a pair of single quote marks. So b, . and 5 are all valid examples of character constants. Note that a character constant, which is a single character enclosed in single quotes is different from a character string, which is any number of characters enclosed in double quotes. The format characters %c can be used in a printf statement to display the value of a char variable at the terminal. Program 4.5: The following program illustrates how to use char data type. #include<stdio.h> main() { char c=A; int a=65; printf(%c\n, c); printf(%d\n, c); printf(%c\n,a); } Output A 65 A Note that with the format characters %d, the ASCII number of the character is displayed. With the format character %c, the character corresponding to the given ASCII number is displayed.
.