a) A syntax error occurs when the code violates one or more grammar rules of C...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
a) A syntax error occurs when the code violates one or more grammar rules of C and is detected by the compiler as it attempts to translate the program. If a statement has a syntax error, it cannot be translated, and the program will not be executed. Single syntax error may lead to many error messages. Given a program as listed below. line 221 222 223 266 267 270 271 272 273 274 275 268 int 269 main(void) 1 276 277 278 279 280 281 282 283 Source code /*convert distances from miles to kilometers */ #include<stdio.h> #define KMS_PER_MILE 1.609 iii. double kms /*get the distance in miles*/ printf("Enter the distance in miles>"); scanf("%lf", &miles); /*convert the distance to kilometers */ Kms KMS_PER_MILES* miles; /*Display the distance in kilometers* / printf("That equals %f kilometers.\n", kms); return (0); i. Identify and correct the error in the program. Hence, briefly explain effect of the errors identified to the program. ii. Justified the error "not always the line containing the programmer's mistake" by giving the sample from the given program. What is your strategy to correct the syntax errors? a) A syntax error occurs when the code violates one or more grammar rules of C and is detected by the compiler as it attempts to translate the program. If a statement has a syntax error, it cannot be translated, and the program will not be executed. Single syntax error may lead to many error messages. Given a program as listed below. line 221 222 223 266 267 270 271 272 273 274 275 268 int 269 main(void) 1 276 277 278 279 280 281 282 283 Source code /*convert distances from miles to kilometers */ #include<stdio.h> #define KMS_PER_MILE 1.609 iii. double kms /*get the distance in miles*/ printf("Enter the distance in miles>"); scanf("%lf", &miles); /*convert the distance to kilometers */ Kms KMS_PER_MILES* miles; /*Display the distance in kilometers* / printf("That equals %f kilometers.\n", kms); return (0); i. Identify and correct the error in the program. Hence, briefly explain effect of the errors identified to the program. ii. Justified the error "not always the line containing the programmer's mistake" by giving the sample from the given program. What is your strategy to correct the syntax errors?
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Each of the statements that follow violates one or more accounting concepts. State which of these selected qualitative characteristics and accounting conventionsrelevance, faithful representation,...
-
A billboard says that it is 12.5miles or 20 kilometers to the next gas station. Use this information to find a mathematical model that relates miles x to kilometers y. Then use the model to find the...
-
Listed below are measured amounts of lead (in micrograms per cubic meter, or mg/m3, in the air. The Environmental Protection Agency has established an air quality standard for lead of 1.5 mg/m3. The...
-
At t = 0, a particle is traveling parallel to very large insulating plate at a 0.360 m distance with a speed of 980 m/s. Consider that the insulating plate has uniform surface charge density 2.34. x...
-
List and discuss possible ways to optimize IT costs.
-
The IIAs Code of Ethics, and answer the following questions: a. Why is it important for the internal audit profession to have a code of ethics? b. How do the Code of Ethics Principles differ from...
-
According to the Plex website, in their Enterprise Resource Planning Systems cost accounting software modules you can: Set up a flexible, detailed cost structure for each operation and for each...
-
So far our discussion and focus has been on business combinations where 100% of another company has been acquired. In reality, complete ownership does not always take place. When a company does not...
-
Kirinyaga Hydraulic Contractors in partnership with the World Bank are embarking on a water project in Mukurweini Division. They are contemplating to gauge the benefits of the project through cost-...
-
The following picture shows four routers, A,B,C,D. Packets travel from A and B to D. All routers including C operate in FIFO order. If two packets arrive at C at the same time, give priority to...
-
Three vectors, labelled A-C, are shown below. A new vector, named vector D, is defined by an equation in the picture. Describe the general direction of vector D. 100 = B + - A
-
Use the following information to answer the below questions pertaining to the adjusting entries of Afaaq Company and Noor Takaful. Afaaq Company purchased an insurance policy for $5,000 on December...
-
Match the disorder with the culture in which it is most common: a. Amok b. Anorexia nervosa c. Brain fag Catatonic schizophrenia India b. Malaysia a. United States d. West Africa C.
-
List the main factors affecting the computation of depreciation charges.
-
States of extreme euphoria and energy paired with severe depression characterize __________disorder.
-
Discuss the concept of full disclosure in Islamic accounting.
-
Pluto Corporation has an opportunity to acquire a factory in another part of the country. After careful analysis, Pluto has decided to raise the necessary capital for the acquisition by issuing...
-
Software Solution is family-owned business that has been in operation for more than 15 year. The board of directors is comprised of mainly family members, plus a few professionals such as an...
-
On September 14, 2012, Jay purchased a passenger automobile that is used 75 percent in his accounting business. The automobile has a basis for depreciation purposes of $35,000, and Jay uses the...
-
Yolanda is a cash basis taxpayer with the following transactions during the year: Cash received from sales of products........................................................................$65,000...
-
Scott Butterfield is self-employed as a CPA. He uses the cash method of accounting, and his Social Security number is 644-47-7833. His principal business code is 541211. Scott's CPA practice is...
-
What is a program?
-
List the five major components of a computer system.
-
What is hardware?
Study smarter with the SolutionInn App