Question: Please Write the program in standard C language and please include the screenshots from the IDE and also please explain. Thanks. An assignment statement consists

Please Write the program in standard C language and please include the screenshots from the IDE and also please explain.
Thanks.  Please Write the program in standard C language and please include

An assignment statement consists of four parts: (a) The left hand side which must be a variable (b) The assignment operator,- (c) The right hand side which can be any legal expression (d) A semicolon, which terminates the statement The most complicated part is the RHS, for C allows expressions of various sorts (e-g function calls, variables, constants, expressions involving arithmetic operators). But, we will limit the RHS to the one of the following (a) A constant (b) A variable (c) One function call, with only constants or variables as arguments (d) An expression with one binary arithmetic operator (tr. %) in which the operands must be constants or variables The following are examples of legal RHS of assignment operators under our rules X- 12; x=y; x=fun(12); X-y +z; Y x+12; The following are examples of illegal RHS of assignment operators under our rules x-funl (fun2(x)); illegal-nested function call X-y+z+10; illegal- two operators x - funl(x)+z,illegal operand * x- fun(al, a2)/* two operands X =:/.illegal as RHS is not variable or constant, which can only be a number X-fun( 1c); /* illegal variable name on RHS . We allow any amount of white space to separate parts of the assignment statement. You may assume that no assignment statement consists of more than 50 characters including white space (a tab, blank, and newline counts as a single character). Write a program that prompts the user to enter an assignment statement at the keyboard and then tests whether it is legal under our restrcited syntax. If the assignment is legal, output "This statement is legal", else if it is not illegal, output This statement is illegal" without stating what exactly is wrong with the statement, eg X = 12; You echo: X-12; This statement is legal X-y+z+ 10; You echo: X-y+z+ 10 This statement is illegal Follow the C rules for identifiers, under which, for example, a variable's name may not begin with a number. Also, you will have to check for variables on the LHS or the RHS of the expression and also as an argument to a function. The program echoes each statement (there will be multiple statements) as it is read and then prints out a message about its legality. The function main does only input, output. Use only getchar for input. The rest of the work must be done by other function(s). Hint: The program needs to remember the previous character read so that the two can be compared. For example, the assignment statement's LHS may not consist of a letter, a white space, and another letter

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!