Preview

Programming Language Comparison

Good Essays
Open Document
Open Document
3807 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Programming Language Comparison
Syntax This section does not cite any references or sources. Please help improve this section by adding citations to reliable sources. Unsourced material may be challenged and removed. (June 2013)
Syntactically, Pascal is much more ALGOL-like than C. English keywords are retained where C uses punctuation symbols – Pascal has and, or, and mod where C uses &&, ||, and % for example. However, C is actually more ALGOL-like than Pascal regarding (simple) declarations, retaining the type-name variable-name syntax. For example, C can accept declarations at the start of any block, not just the outer block of a function.
Semicolon use
Another more subtle difference is the type of delimiter used. In Pascal semicolons separate individual statements within a compound statement and also used to terminate a statement. They are also syntactically part of the statement itself in C (transforming an expression into a statement). This difference manifests itself primarily in two situations:
• there can never be a semicolon directly before else in Pascal whereas it is mandatory in C (unless a block statement is used)
• the last statement before an end is not required to be followed by a semicolon
A superfluous semicolon can be put on the last line before end, thereby formally inserting an empty statement.
Comments
In traditional C, there are only /* block comments */. This is only supported by certain Pascal dialects like MIDletPascal.
In traditional Pascal, there are { block comments } and (* block comments *). Modern Pascal, like Object Pascal (Delphi, FPC), as well as modern C implementations allow C++ style comments // comments
Identifiers and keywords
C and Pascal differ in their interpretation of upper and lower case. C is case sensitive while Pascal is not, thus MyLabel and mylabel are distinct names in C but identical in Pascal. In both languages, identifiers consist of letters and digits, with the rule that the first character may not be a digit. In C, the

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Pascal was invented in 1970 by niklaus wirth a small but very precise language meant to promote good programming practices.…

    • 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

    This shows that there must be atleast one letter present for being identified as an identifier. It can have any number of letters in an identifier but they should be in lower-case.…

    • 703 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Procedural language is used for developing simple applications. The languages that use the procedural programming are Pascal and C languages. Some of the benefits of the procedural programming are: easy to read program code, easily maintainable program code as various procedures can be debugged in isolation, code is more flexible as you can change a specific procedure that gets implemented across the program.…

    • 337 Words
    • 1 Page
    Satisfactory 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

    science 23 answers

    • 12424 Words
    • 61 Pages

     In C, "&&" and "||" are short-circuit boolean operators just like in Java, while the "&" and "|" operators in C…

    • 12424 Words
    • 61 Pages
    Satisfactory Essays
  • Satisfactory Essays

    I Like to 1321

    • 459 Words
    • 2 Pages

    statement. Also included is a for loop (repetition statement). Pay close attention to these as you…

    • 459 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    declaration. The use of a period at the end of this line only further proves that this is such…

    • 1519 Words
    • 7 Pages
    Powerful Essays
  • Good Essays

    It-250 Week 5 Questions

    • 397 Words
    • 2 Pages

    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.…

    • 397 Words
    • 2 Pages
    Good Essays
  • Good Essays

    2. The original UNIX system was written in PDP-7 assembly language and the subsequent version was written in a language called B, which was developed by Thompson in 1970.…

    • 537 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    Worldcom Swot Analysis Paper

    • 2327 Words
    • 10 Pages

    Please help improve this section by adding citations to reliable sources. Unsourced material may be challenged and removed. (September 2013)…

    • 2327 Words
    • 10 Pages
    Powerful Essays
  • Powerful Essays

    Task 1

    • 2644 Words
    • 8 Pages

    Procedural programming uses C programming language. C is considered to be a general purpose, work-horse language ideal for creating applications. Operating systems and interfacing with electronic control systems. It was made in 1972 by Dennis Ritchie at the Bell Telephone Laboratories. Unlike languages such as BASIC and PASCAL, C relies on symbols rather than keywords. As such, it is often described as being ‘terse’ and more difficult to learn, but typically offer more powerful solutions…

    • 2644 Words
    • 8 Pages
    Powerful Essays
  • Satisfactory Essays

    Java uses a right brace to mark the end of all compound statements. What are the arguments for and against this design The argument for using the right brace to close all compounds is simplicity a right brace always terminates a compound. The argument against it is that when you see a right brace in a program the location of its matching left brace is not always obvious in part because all multiple-statement control constructs end with a right…

    • 80 Words
    • 1 Page
    Satisfactory Essays
  • Good Essays

    Without a semicolon it can be harder for the reader to understand a correlation or relationship between the ideas in each independent clause…

    • 919 Words
    • 4 Pages
    Good Essays
  • Good Essays

    | This section does not cite any references or sources. Please help improve this section by adding citations to reliable sources. Unsourced material may be challenged and removed. (April 2010)…

    • 995 Words
    • 4 Pages
    Good Essays