How can One Determine Whether a Right Shift of a Signed Value is Performed as an Arithmetic or a Logical Shift

Question: How can One Determine Whether a Right Shift of a Signed Value is Performed on Linux Machine as an Arithmetic or a Logical Shift Answer: Right and Left shift operators are Bitwise Binary Operators operate on Individual Bits of their Integer Operands. On Linux Machine, Logical and Arithmetic Right and Left Shifts on Unsigned … Read more

advertisement

L Value and R Value in C Language with Examples

This C Tutorial explains L and R Values in C Language and How are they Used in C Programs with Examples. We are quite very much familiar with various types of assignment statements. For example: hny = "Happy New Year 2014!"; /* a character string */ count += 1; /* an integer */ cats = … Read more

advertisement

Unary Operators in C

This C Tutorial explains different Unary Operators in C Programming with examples and how they Operate on their Operands. What is Unary Operator in C? A unary operator is an operator that operates on a single operand. The most common unary operators are the increment (++) and decrement (–) operators. Unary operators can be used … Read more

advertisement

Cast Operator in C

This C Tutorial explains Cast Operator in C Programming with examples. Sometimes we need to evaluate mixed-type expressions. For example: /*autocast.c — automatic type conversions */ #include <stdio.h> int main(void) { int a = 1, b = 2; float val = 3, z = 4, x; char new = ‘A’, old = ‘B’, ch;   … Read more

advertisement

Is sizeof Operator in C Evaluate the Expression for Determining its Size

Question: Is sizeof Operator in C Evaluate Expression for Determining its Size? Answer: Firstly we consider a simple example: /* * sizeof_eval_exp.c — program displays if sizeof evaluates an expression * as operand */ #include <stdio.h> int main(void) { int a = 1; int arr[10] = {1,2,3,4,5,6,7,8,9,10};   printf("size of int a and value of … Read more

advertisement

Boolean Values in C

This C Tutorial explains Boolean Values and Whether C have an Explicit Boolean Type. C doesn’t have an explicit Boolean type so integers are used instead. Boolean values are TRUE and FALSE or ON and OFF or 1 and 0 respectively. According to rule, 1 is considered TRUE and 0 is FALSE. However, any nonzero … Read more

advertisement

What does sizeof Operator Return in C?

This C Tutorial explains sizeof Operator in C Language and the Type of Value Returned by the operator. The sizeof operator returns the size, in bytes, of its operand. Recall that a C byte is defined as the size used by the char type. In the past, this has most often been 8 bits, but … Read more

advertisement

Comma Operator in C with Examples

This C Tutorial explains Comma Operator in C with examples. What is a Comma operator in C? The comma operator is a binary operator that evaluates its first operand and discards the result, then evaluates its second operand and returns its value. Comma operator represented by ‘,’ ensures the evaluation from left to right, one … Read more

advertisement

Conditional Operator in C

This C Tutorial explains the Conditional Operator in C with examples. What is Conditional Operator in C? The conditional operator, also known as the ternary operator, is a operator that takes three operands. The first operand is a boolean expression, and the second and third operands are values. If the boolean expression evaluates to true, … Read more

advertisement

Increment and Decrement Operators in C with Examples

This C Tutorial explains Increment and Decrement Operators in C. Well! ++ and — are two Increment and decrement operators in C. Each operator has two forms and these are prefix and postfix forms. In prefix form, the operand comes after the operator while in postfix form operand comes before the operator. For example: ++man; … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.