Determine whether a given string with no white space

Assignment Help Computer Engineering
Reference no: EM132155867

Use C language

Write a program to determine whether a given string with no white space characters is a valid C identifier.

The input to the program will be a number of lines, each of which contains a string, which you can assume has no white space characters before the new line at the end of the line.

Your program should scan the string, character by character, using getchar(), and determine if it is a valid C identifier, based on the rules discussed in class, and covered in the class slides.

Keep in mind that, although identifiers which begin with an underscore are not used by user application programs in C by convention, they are valid C identifiers, so your program should accept them.

There will be 5 strings in the input.

For each of these strings, after determining whether it is a valid C identifier or not, your program should print out either "Valid" or "Invalid", followed by a new line (that is, each "Valid" or "Invalid" result will be printed on a separate line in

the output).

Suppose the following input:

_Number1 1_2_3 total

Num1+Num2 big_number!

The output should be: Valid

Invalid Valid Invalid Invalid

Your program can use either if statements or switch statements for much of the algorithm. You CANNOT use C library functions such as isalpha() or isdigit(), which we will see later

Also keep in mind that you may need to "consume" remaining characters on the line after determining that a given line of input contains an invalid identifier.

CONSTRAINTS:

You cannot use arrays of any kind (including strings).

You CANNOT use C library functions other than getchar() and printf().

Reference no: EM132155867

Questions Cloud

Sampling distribution of the sample mean : A random sample of size 122 was taken from a population with a population mean 29 and a population standard deviation 4.
Draw the abstract syntax tree and label the nodes : Derive the constraint set and the test set T_bor-mi for the following predicate pr: ab[c + !cd] where a, b, c, d are Boolean variables.
Receiving a failing grade : The professor awards the top 30% grade of A, the next 30% grade of B, and the next 30% grade of C. With the last 10% receiving a Failing grade
What is the probability of getting the disease : What is the probability of getting the disease when the father never had the disease?
Determine whether a given string with no white space : Write a program to determine whether a given string with no white space characters is a valid C identifier.
Estimate the true proportion of ers calls : Estimate the true proportion of ERS calls that involved serious mechanical problems requiring towing and construct a 95% confidence
Data below record the number of hours a team : The data below record the number of hours a team of workers takes to assemble a custom-built motorcycle. The data are recorded for 10 different teams each
Predicted total body weight for a female athlete : The predicted total body weight for a female athlete who is 62 inches tall and has 30% body fat is how many pounds?
Find the percentile score for mean of the students : Find the percentile score for mean of the students from the student section. Note: (µ = 65) and (s = 12).

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd