A presentation regarding on misc operator.Hopefully who search this on that topic to find some logistical knowledge from this file.
Size: 171.76 KB
Language: en
Added: Jun 22, 2020
Slides: 8 pages
Slide Content
Bangladesh University A Presentation on Misc operators in C program Fundamentals of Computers (PHA – 1142) Submitted By, Sa jidur Rahman Akash (202011235050) Diba Ra ni Saha (202011235049) Mobashara Bithi (202011235048) Tasnea Azad (202011235047) Md. Shansha Hossain (202011235045) Submitted to, Ahsan Habib Lecturer, Department of Comupter Science Engineering Bangladesh University, Dhaka
What is Misc Operator ? Misc operator is miscellaneous operator, which is conditional operator which has 3 operands,The first operand is always evaluated first. If nonzero, the second operand is evaluated, and that is the value of the result. Otherwise, the third operand is evaluated, and that is the value of the result.
There many misc operators in c program.Some of them describe below. Size of Operator & (Referencing) Operator * (Dereferencing) Operator ? “ (Turnery) Operator
Size Operator : The operatoe takes operand (variable name/data type keyword) as parameter and return to the memory sise consume by the operand in bytes. Let us assume a as integer varible. Then,size of (a) will return 4 (for 32 bit C compilers)or 2 (for 16 bit C compilers) Similarly size of (float) will return 4,size of (char)will return 1 etc.
2. & (Referencing /Address) Operator : It uses only one operand on it‘s right and it returns the memory address of the operand as unsigned integer data type. printf (“% u “, & a); will display 6422316 (may be diferent on different machine & every execution) on the console. 3. * (Diferencing) Operator : It is pointer to the varible.This operator used to declare the pointer varible & extracting the value stoned at the address stored in pointer varible. Let ue assume a=10, * b = & a, If we write c = * b then,c will be 10.
4.? : (Conditional) Operator : This operator requires three expression. (i) Conditional Expression. (ii) Expression to execute if condition is true. (iii) Expression tl execute if condition is false. Syntax : (Condition)? (Expression for true) : (Expression for false) Let us assume a = 5, b = 1 If c = (a> b)? a:b ; then the value of c will be 5. If c = ( a<b)? a : b ; the the value of c will be 1.
Here is an example of misc operator. #include <stdio.h> int main() { int a = 16; printf("Size of variable a : %d\n",sizeof(a)); printf("Size of int data type : %d\n",sizeof(int)); printf("Size of char data type : %d\n",sizeof(char)); printf("Size of float data type : %d\n",sizeof(float)); printf("Size of double data type : %d\n",sizeof(double)); return 0; Output Size of variable a : 4 Size of int data type : 4 Size of char data type : 1 Size of float data type : 4 Size of double data type : 8