Fresh features from the #1 AI-enhanced learning platform.Try it free
Fresh features from the #1 AI-enhanced learning platformCrush your year with the magic of personalized studying.Try it free
Question

T F A structure member variable may be passed to a function as an argument.

Solution

Verified
Answered 2 months ago
Answered 2 months ago
Step 1
1 of 2

A structure member variable could be passed as an argument to any function just like any other variables,

// ======================================================
// define the structure, representing group of 
// related data
struct StructName{
    DataType1 member1;    
    DataType2 member2;
        .        .
        .        .
        .        .
    DataTypeN memberN;
};

// ======================================================
// create a structure variable,
StructName var;
    .
    .
    .
// ======================================================
// passing structure member variable as an argument

// we pass members 3 and 1 to someFunc
someFunc(var.member3,var.member1);
// NOTE: we could deal with members like any other 
//       variables, so they could be assigned, copied,
//       or any other valid operation depending on 
//       its type independently.
// ======================================================

Create an account to view solutions

Create an account to view solutions

Recommended textbook solutions

Computer Organization and Design MIPS Edition: The Hardware/Software Interface 5th Edition by David A. Patterson, John L. Hennessy

Computer Organization and Design MIPS Edition: The Hardware/Software Interface

5th EditionISBN: 9780124077263David A. Patterson, John L. Hennessy
226 solutions
Starting Out with C++ from Control Structures to Objects 8th Edition by Godfrey Muganda, Judy Walters, Tony Gaddis

Starting Out with C++ from Control Structures to Objects

8th EditionISBN: 9780133769395Godfrey Muganda, Judy Walters, Tony Gaddis
1,373 solutions
Fundamentals of Database Systems 7th Edition by Ramez Elmasri, Shamkant B. Navathe

Fundamentals of Database Systems

7th EditionISBN: 9780133970777 (1 more)Ramez Elmasri, Shamkant B. Navathe
866 solutions
Introduction to Algorithms 3rd Edition by Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen

Introduction to Algorithms

3rd EditionISBN: 9780262033848 (5 more)Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
849 solutions

More related questions

1/4

1/7