Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Passing Structs to Functions | Struct Fundamentals
C++ Structures and Enumerations
セクション 1.  4
single

single

bookChallenge: Passing Structs to Functions

メニューを表示するにはスワイプしてください

When you pass a struct by reference to a function, any changes made inside the function affect the original struct, allowing you to modify its data directly. This is especially useful for updating specific fields, such as changing the age of a Person struct.

タスク

スワイプしてコーディングを開始

Complete the function so that it updates the age of a Person struct passed by reference.

  • Set the age member of the given Person to the value provided in the newAge parameter.
  • After calling updateAge, print the updated age using the template string: "Updated age: {age}".

解答

Switch to desktop実践的な練習のためにデスクトップに切り替える下記のオプションのいずれかを利用して、現在の場所から続行する
すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 1.  4
single

single

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

some-alt