The iswblank () function in C++ is used to check if the given wide character is blank not. It is present in “ctype.h” header file in C language and “cctype” header file in C++ Standard template library (STL).Syntax of iswblank is as followsint iswblank(wint_t ch)Return Type − returns non zero value if it contains blank spaces and value 0 if it doesn’t.Parameters − ch − This is the character to be checked.ExampleInput − string str = “I Love Myself”Output − total number of spaces is − 2Input − string str = “Myself”Output − total number of spaces is − 0Approach used ... Read More
With given array the task is to create a function which will return pointer to an array of integer function pointers.For that we will input the two values and call a function which compares both the two values and functions pointer which return the memory address of bigger value and print it as a result. The function pointer is used to pass address of different function at different times thus making the function more flexible and abstract. So function pointers can be used to simplify code by providing a simple way to select a function to execute based on run-time ... Read More
Problem statementGiven an array of non-negative integers and an integer k, find the subset of maximum length with bitwise OR equal to k.ExampleIf given input array is = [1, 4, 2] and k = 3 then output is: [1, 2] The bitwise OR of 1 and 2 equals 3. It is not possible to obtain a subset of length greater than 2.AlgorithmBelow are the properties of bitwise OR −0 OR 0 = 0 1 OR 0 = 1 1 OR 1 = 1for all the positions in the binary representation of k with the bit equal to 0, the corresponding ... Read More
In C++ standard template library(STL), iswlower() function is used to check if the given wide character is in lowercase or not, if not then the function will return a zero value. The characters with ASCII value from 97 to 122 i.e. a-z are the lowercase alphabetic letters. Iswlower() function is present in cctype header file in C/C++.Syntax of iswlower () is as followsint iswlower (wint_t c)Parameters − c is a wide character to be checked, casted to a wint_t, or WEOF where wint_t is an integral type.Return Value − islower() function return non-zero value when the string is in lowercase ... Read More
It is possible to get a custom request header's value in an apache CGI script with python. The solution is similar to this.Apache's mod_cgi will set environment variables for each HTTP request header received, the variables set in this manner will all have an HTTP_ prefix, so for example x-client-version: 1.2.3 will be available as variable HTTP_X_CLIENT_VERSION.So, to read the above custom header just call os.environ["HTTP_X_CLIENT_VERSION"].The below script will print all HTTP_* headers and values −#!/usr/bin/env python import os print "Content-Type: text/html" print "Cache-Control: no-cache" print print "" for headername, headervalue in os.environ.iteritems(): if headername.startswith("HTTP_"): print "{0} = {1}".format(headername, headervalue) ... Read More
The StringTokenizer class of the java. util package allows an application to break a string into tokens.This class is a legacy class that is retained for compatibility reasons although its use is discouraged in new code.Its methods do not distinguish among identifiers, numbers, and quoted strings.These class methods do not even recognize and skip comments.ExampleLive Demoimport java.util.*; public class Sample { public static void main(String[] args) { // creating string tokenizer StringTokenizer st = new StringTokenizer("Come to learn"); // checking next token System.out.println("Next token is : " + st.nextToken()); } }OutputNext token is : Come
Yes. Following while loop is a valid statement and causes an infinite loop.while(true);
The loop control statement continue abandons the pending statements in current iteration of the looping block and starts next iteration. The continue statement appears in a conditional block inside loopExamplex=0 while x
The else block in a loop (for as well as while) executes after all iterations of loop are completed and before the program flow exits the loop body. The syntax is as follows −Syntaxwhile expr==True: #statements to be iterated while expr is true. else: #this statement(s) will be executed afteriterations are over#this will be executed after the program leaves loop bodyexamplefor x in range(6): print (x) else: print ("else block of loop") print ("loop is over")OutputThe output is as shown below −0 1 2 3 4 5 else block of loop loop is over
An lvalue has an address that your program can access. Examples of lvalue expressions include variable names, including const variables, array elements, function calls that return an lvalue reference, bit-fields, unions, and class members. A xvalue expression has no address but can be used to initialize an rvalue reference, which provides access to the expression. Examples include function calls that return an rvalue reference, the array subscript, etc. A glvalue (“generalized” lvalue) is an lvalue or an xvalue. An rvalue (so-called, historically, because rvalues could appear on the right-hand side of an assignment expression) is an xvalue, a temporary object or subobject thereof, ... Read More