Preview

It-250 Week 5 Questions

Good Essays
Open Document
Open Document
397 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
It-250 Week 5 Questions
IT-250
Week 5 Questions 1. What function does every C program have? Why should you split large programs into several functions?
Functions named main (). Easy to trouble shoot problems with C program coding errors. 2. What command could you give to compile prog.c and func.c into executable named cprog?

$ cc -o cprog prog.c func.c 3. Show two ways to instruct the C preprocessor to include the header file /usr/include/math.h in you C program. Assuming that the declar.h header file is located in the subdirectory named headers of your home directory, described two ways to instruct the C preprocessor to include this header file in your C program.

#include "other.h", #include <stdio.h>, #included “math.h”, #included<math.h>, #included “declar.h”, #included <declar.h>

4. How many names of systems libraries abbreviated on the gcc command line? Where does gcc search for libraries named in this manner? Describe how to specify your own library on the gcc command line.

Libraries USE names such as libxxx.a or libxxx.so. When linked on the command line with a library, strip the lib prefix and .a or .so suffix; then prefix the remaining name with –l, as in –lxxx. By default gcc searches the /usr/lib directory for libraries. When you specify –Lpathname on the command line, gcc searches the pathname directory for each instance of –L. Here are two command lines you could use:
$ gcc -o myprog myfile.c -L/home/mine -lyyy
$ gcc -o myprog myfile.c /home/mine/libyyy.a

5. Write a makefile that reflects the following relationships: a. The C source files transactions.c and reports.c include a header file named accts.h b. The header file accts.h c. The Header file accts.h is composed of two other header files: trans.h and reps.h.

A: transactions.c and reports.c are compiled to produce an executable file named accts –ctransactions.c o transactions.o -c reports.c –o reports.o transactions.o reports.o –o my

You May Also Find These Documents Helpful

  • Satisfactory Essays

    In 1970 C programing was created by Dennis Richie and ken Thompson was made to create portability in UNIX…

    • 388 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Nt1310 Unit 3 Quiz

    • 6337 Words
    • 26 Pages

    What is the primary purpose of the __P() macro? Choice 1 The __P() macro has no function, and merely obfuscates library function declarat ions. It should be removed from further releases of the C library. Choice 2 The __P() macro provides forward compatibility for C++ compilers, which do not r ecognize Standard C prototypes. Choice 3 Identifiers that begin with two underscores are reserved for C library implement ations. It is impossible to determine the purpose of the macro from the context given. Choice 4 The __P() macro provides backward compatibility for K&R C compilers, which do no t recognize Standard C prototypes. Choice 5 The __P() macro serves primarily to differentiate library functions from applica tion-specific functions. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*question number 68*/ Which one of the following is NOT a valid identifier? Choice 1 __ident Choice 2 auto [Ans] Choice 3 bigNumber Choice 4 g42277 Choice 5 peaceful_in_space - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*question number 69*/ /* Read an arbitrarily long string. */ Code: int read_long_string (const char ** const buf) { char * p = NULL; const char * fwd = NULL; size_t len = 0; assert(buf); do { p = realloc(p, len += 256); if (!p) return 0; if (!fwd) fwd = p; else fwd = strchr(p, '\0'); } while (fgets(fwd, 256, stdin)); *buf =…

    • 6337 Words
    • 26 Pages
    Good Essays
  • Good Essays

    C Is difficult, because the control flow is out of the hands of the application programmer…

    • 1508 Words
    • 7 Pages
    Good Essays
  • Satisfactory Essays

    This file of COM 155 Assignment Appendix D contains: Identify Twenty Errors in the Passage Below…

    • 691 Words
    • 4 Pages
    Satisfactory Essays
  • Better Essays

    2) The header is the starting point and the body is a list of statements that belong to the module.…

    • 1580 Words
    • 11 Pages
    Better Essays
  • Satisfactory Essays

    h. The set of all strings consisting of the keyword begin, followed by one or more statements with a semicolon after each one, followed by the keyword end. Use the non-terminal for statements, and do not give productions for it.…

    • 470 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    PT1420 Assign. 10

    • 702 Words
    • 4 Pages

    Described the three steps that must be taken when a file is used by a program.…

    • 702 Words
    • 4 Pages
    Good Essays
  • Good Essays

    3. Why must a program specifically be compiled for debugging to be able to execute that program in a debugger? What two things does the compiler do to assist a debugger?…

    • 567 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    Task 1

    • 2644 Words
    • 8 Pages

    Explain the limitations of the following three program approaches and include two typical uses of each:…

    • 2644 Words
    • 8 Pages
    Powerful Essays
  • Satisfactory Essays

    Risk vs Cisk

    • 670 Words
    • 3 Pages

    Consider the the program fragments: mov ax, 0 mov bx, 10 mov cx, 5 add ax, bx loop Begin…

    • 670 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    4 . When a program or module uses another module, you can refer to the main program as the ____ program.…

    • 2498 Words
    • 10 Pages
    Satisfactory Essays
  • Powerful Essays

    Meteorologist

    • 1037 Words
    • 5 Pages

    • aux/ : Fortran 77 sourcecode for auxiliary programs that are used in the compilation and…

    • 1037 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    1. a) What is the front end and back end of a compiler? What are the (08)…

    • 720 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    Assignment Ignou Acc 1

    • 1347 Words
    • 6 Pages

    You will have to do one assignment as part of the Course ACC-1. THIS ASSIGNMENT IS COMPULSORY. The assignment has three parts—Section A, B and C. Section ‘A’ comprises theoretical questions and the other two Sections comprise practical exercises. The assignment carries 100 marks; 60 marks for Section A and 20 marks for each of the other two Sections.…

    • 1347 Words
    • 6 Pages
    Powerful Essays
  • Satisfactory Essays

    3. Discuss the principle sources of optimiztion. What are the various ways of calling procedures ?…

    • 351 Words
    • 2 Pages
    Satisfactory Essays

Related Topics