What is the purpose of the restrict keyword in c99

Assignment Help JAVA Programming
Reference no: EM13324967

1. Character strings in C and C++ are implemented as arrays of char. These arrays can be initialized to string constants, as in
char name [] = "freddie";

The array name will have eight elements, because all strings are terminated with a null character (zero), which is implicitly supplied by the system for string constants.

Arrays of strings in C and C++ can also be initialized with string literals. In this case, the array is one of pointers to characters. For example,
char *names [] = {"Bob", "Jake", "Darcie"};

This example illustrates the nature of character literals in C and C++. In the previous example of a string literal being used to initialize the char array name, the literal is taken to be a char array. But in the latter example (names), the literals are taken to be pointers to characters, so the array is an array of pointers to characters. For example, names[0] is a pointer to the letter 'B'in the literal character array that contains the characters 'B', 'o', 'b', and the null character.

In Java, similar syntax is used to define and initialize an array of references to String objects. For example,

String[] names = ["Bob", "Jake", "Darcie"];

From above it shows one way to create an array of strings in C or C++:
Char *name[] = {"Bob", "Jake", "Darcie"};
There is another way to get a similar effect, however:
Char *name[] [7] = {"Bob", "Jake", "Darcie"};

Compare these two techniques with respect to ease of use and efficiency.

2. a. Which class (es) in Java API represented associative array?
b. Which class(es) in the C++ standard library represent associative arrays?

3. Translate the following Ada record type into Java. Your translation should be as close to the original as possible.

type Employee_Name_Type is
record
First: String(1..20);
Middle: String(l..10);
Last: String(1..20);
end record;


4. Suppose that L1 is the list ((A B) C D) and L2 is the list ((E) F). give the value of each of the following LISP expression:
1. (CONS (CAR L1) (LIST (CDR L2)))
2. (CONS (CAR (CDR L2)) (CAR L1))
3. (CDR ( CONS (CAR (CONS ‘G L1)) ‘ (H))
4. (LIST (LIST (CAR L1) L2) ‘G)

5. a. Are the unions in Modula-2 considered to be "free unions"? Explain your answer.
b. type Shape is (Circle, Triangle, Rectangle);
type Colors is (Red, Green, Blue);
type Figure (Form : Shape) is
record
Filled : Boolean;
Color : Colors;
case Form is
when Circle =>
Diameter : Float;
when Triangle =>
Left_Side : Integer;
Right_Side : Integer;
Angle : Float;
when Rectangle =>
Side_1 : Integer;
Side_2 : Integer;
end case;
end record;
Translate the Ada variant record (above) to Modula-2.

6. a. what is the purpose of the restrict keyword in C99?
b. Give an example showing how restrict is used.

Reference no: EM13324967

Questions Cloud

Find direction of the electric field halfway between them : Point charges of 30.0 µC and 50.0 µC are placed 0.500 m apart. What is the magnitude and direction of the electric field halfway between them
Evidence of excess supply or excess demand : Examples of actions taken by a company, government, or organization whose effect is to prevent specific markets from reaching equilibrium. What evidence of excess supply or excess demand can you cite in these examples?
Define the relative nucleophilicity of the indicated species : Rank the relative nucleophilicity of the indicated species in ethanol. CH3OH CH3S- CH3COOH CH3O- CH3COO-
Accumulation of large amounts of data from multiple sources : The systematic accumulation of large amounts of data from multiple sources
What is the purpose of the restrict keyword in c99 : Arrays of strings in C and C++ can also be initialized with string literals. In this case, the array is one of pointers to characters.
Theatre-formulate a manifesto for the art of acting : Theatre/formulate a manifesto for the art of acting. a manifesto is a brief passionate and personal statement of belief and purpose include: what you want to do for the world through your acting? what you must do to empower youself to achieve you pur..
Evaluate the equilibrium constant for a reaction : Calculate the equilibrium constant at 40 K for a reaction with ?Ho = 10 kJ and ?So = 100 J/K.
Find the average velocity of the dot : A web page designer creates an animation in which a dot on a computer screen has a position of r? =[ 4.2cm +( 2.3cm/s2 )t2]i^+( 4.5cm/s )tj^
Write a constraint for policy using pandey : The method willaccept returns 1 if the named process will accept messages, and 0 otherwise. Write a constraint for this policy using Pandey and Hashii's policy constraint language as described in the first example in Section 4.5.1.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Modify the scholarship application

Modify the Scholarship application so that if a user enters a grade point average under 0 or over 4.0, or a negative value for either of the activities, an error message appears.

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

  Identify the 5 code elements

Identify the 5 code elements for a Password class. Things like: class, instance, and final variables, accessor and mutator method, public and private specifiers for methods and member variables.i need to provide detail and descriptions for each code ..

  The drink machine should have a supply

When the applet starts, the drink machine should have a supply of 20 of each of the drinks. The applet should have a text field where the user can enter the amount of money he or she is giving the machine. The user can then click on a button to selec..

  Write a class that implements an ordered list of strings

In this problem you will write a class that implements an ordered list of Strings.

  Design an abstract data type in java

Design an abstract data type in Java that represents a musical pitch

  Program will read parameters plaintext and ciphertextfrom

Specifically, your program will read parameters, plaintext and ciphertextfrom a file named "input.txt" (under the same directory).Then your program needs tocreate a file named "output.txt" (under the same directory) and prints the public key, private..

  Write a java program that (1) defines a base/super class a

Write a Java program that (1) Defines a base/super class A, a subclass B (inherits from A), and a subclass C (inherits from B). The A class must have a method f() which is not implemented in A,

  A remote web-based file storage application

Develop a web-based application. The server-side part of the application must be developed using Java Servlets (possibly including JSP). The development of the client (browser) side will typically be a combination of HTML and Javascript.

  Write an if statement that uses the flag as the condition

Write an if statement that uses the flag as the condition. Remember that the flag is a Boolean variable, therefore is true or false. It does not have to be compared to anything.

  How large a value can be stored in an integer variable

Most programming languages have a built-in integer data type. Normally this representation has a fixed size, thus placing a limit on how large a value can be stored in an integer variable

  Write a java program that reads unspecified number

Write a java program that reads unspecified number of integers (the input 0 signifies the end of the input). Calculates and displays the sum and the average of the input value (not counting zero). The program also finds the maximum and minimum of ..

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