Question

As noted in this chapter, C and C++ make a distinction between a declaration and a...

As noted in this chapter, C and C++ make a distinction between a declaration and a definition.
Which of the following are declarations only and which are definitions? (a) char * name; (b) typedef int * IntPtr; (c) struct rec;
(d) int gcd(int,int); (e) double y; (f) extern int z;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer :

a) char *name;

Here declaration and definitions both are happening. Name and data type of variables are sent to the compiler and memory is allocated.

d) int gcd(int,int);

Only declaration is done. Name of the function and data type, and number of arguments are  sent to the compiler but no memory is allocated. That's why it is not defined.

f) extern int z;

Here also name of the variable and data type is sent to the compiler. Memory is not allocated for this. Hence only declaration is happening.

e) double y;

Both declaration and definitions are happening. Name and data type of the variable along with memory allocation is sent to the compiler.

Add a comment
Know the answer?
Add Answer to:
As noted in this chapter, C and C++ make a distinction between a declaration and a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Canvas → X COB D Question 12 Consider the following structure definition and variable declaration written...

    Canvas → X COB D Question 12 Consider the following structure definition and variable declaration written in C. struct department int num_employees; char name[ 201: struct department CSdept: Which of the below correctly assigns the value 50 to "num employees' field? CSdept->num employees-5C Which of the below correctly assigns the name CS to the "name" held? [Select] Question 13 What is the output of the following program?

  • I need help on this Systems review please! it's due by midnight monday. Question 1 Not...

    I need help on this Systems review please! it's due by midnight monday. Question 1 Not yet answered Points out of 1.00 Flag question Question text Using these declarations: int * numberPointers[3]; int * pointer; int number; Which of the following statements would generate a warning or error? Select one: a. number = pointer; b. *pointer = number; c. pointer = numberPointers; d. numberPointers[2] = &number; e. a., b., and d. f. a. and c. Question 2 Not yet answered...

  • Problems 9-35 odd numbers only(9,11,13,15 …35) k newNum numi (int) (4.6/2)1 . Do a walk-through to...

    Problems 9-35 odd numbers only(9,11,13,15 …35) k newNum numi (int) (4.6/2)1 . Do a walk-through to find the value assigned to e. Assume that all variables are properly declared. a -31 es" (a%b) * 6; e-(a b+ d)/ 4 10. Which of the following variable declarations are correct? If'a variable declaration is not correct, give the reasoníy) and provide the correct variable declaration. n = 12; char letter int one = 5, two; //Line 3 double x, Y zi //tine...

  • IN C ONLY As mentioned earlier there are two changes we are going to make from...

    IN C ONLY As mentioned earlier there are two changes we are going to make from lab 5, The file you read into data structures can be any length. studentInfo array will be stored in another struct called studentList that will contain the Student pointer and current length of the list. Sometimes data can be used in structs that correlate between variables so it's convenient to store the data in the same struct. Instead of tracking a length variable all...

  • Please use C Programming language (Not C++) 7.6 LAB*: Warm up: Online shopping cart (Part 1)...

    Please use C Programming language (Not C++) 7.6 LAB*: Warm up: Online shopping cart (Part 1) (1) Create three files to submit: • Item ToPurchase.h - Struct definition and related function declarations • Item ToPurchase.c-Related function definitions • main.c-main function Build the ItemToPurchase struct with the following specifications: • Data members (3 pts) • char itemName • int itemPrice • int itemQuantity • Related functions • MakeltemBlank0 (2 pts) Has a pointer to an item To Purchase parameter. Sets item's...

  • Hi the programming language for this assignment is C programming. Could you also please number the...

    Hi the programming language for this assignment is C programming. Could you also please number the answers exactly as they appear in the assignment? Thank you. (9) 1. An array of structures is needed to keep track of 50 grocery items containing the item name, item type, cost, quantity, and tax percentage for each grocery item. The following declarations have already been done: { struct grocery char name[20], type[15]: float cost, taxp: int quan: 3 Also, the following declaration has...

  • (In C) 8.12 LAB: Warm up: Contacts You will be building a linked list. Make sure...

    (In C) 8.12 LAB: Warm up: Contacts You will be building a linked list. Make sure to keep track of both the head and tail nodes. (1) Create three files to submit. ContactNode.h - Struct definition, including the data members and related function declarations ContactNode.c - Related function definitions main.c - main() function (2) Build the ContactNode struct per the following specifications: Data members char contactName[50] char contactPhoneNum[50] struct ContactNode* nextNodePtr Related functions CreateContactNode() (2 pt) InsertContactAfter() (2 pts) Insert...

  • C please In this question, you will find the difference between two time durations. You are...

    C please In this question, you will find the difference between two time durations. You are given the following struct definitions: typedef struct _duration { int hours; int minutes; } Duration; Design a function to find the difference between two durations: Duration* subtract(Duration* duration1, Duration* duration2) { } Return a pointer to a new duration struct that contains the difference between the two. It may be useful to reduce the durations to a single unit (example: minutes), find the difference,...

  • Writing a program in C please help!! My file worked fine before but when I put...

    Writing a program in C please help!! My file worked fine before but when I put the functions in their own files and made a header file the diplayadj() funtion no longer works properly. It will only print the vertices instead of both the vertices and the adjacent like below. example input form commnd line file: A B B C E X C D A C The directed edges in this example are: A can go to both B and...

  • C language not C++ 1. Write the statements to do the following: (2 pts) a. Define...

    C language not C++ 1. Write the statements to do the following: (2 pts) a. Define a struct with member variables width, height, topleft x, topleft y all floats). Use a tag to call it Rectangle. b. Declare a variable struct type Rectangle 2. Consider the following variables: struct int x; float y; char zi var1; union nt x; float y; char[20] z;) var2 f float and int are stored using 4 bytes each, what is the size (in bytes)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT