Example(s):Palindrome, prime, armstrong, "linear search", reverse etc.
Example(s):1575, 1632, 1539 (Only one at a time)
Problem Statement - Finding Valid Multiple value assignments
Which of the following statements is/are valid and why.
Both the statements are valid.
int x; x=1,024; cout<<x<<endl;
This one is a case where declaration has already been done previously. Here we are only assigning values. Since assignment will have higher precedence from comma so x will be assigned as 1 here. Value 024 (Octal 24) will just act as stray expressions and will not have any impact.
This assignment will work as parentheses will be evaluated first. Then assignment will happen by evaluating each term from left to right. Since the expressions inside brackets are separated by commas the last one will be assigned to x. Since last one is 024 which is a way to write Octal values in c++ so decimal version of Octal 24 which is 20 will be printed.