Home / Expert Answers / Computer Science / help-with-creating-c-code-with-arrays-follow-these-instructions-to-complete-your-assignment-1-wr-pa826

(Solved): Help with creating C code with arrays Follow these instructions to complete your assignment: 1. Wr ...



Help with creating C code with arrays

Follow these instructions to complete your assignment:
1. Write \( C \) code for a program that does the following:
- Display

Follow these instructions to complete your assignment: 1. Write \( C \) code for a program that does the following: - Displays the message "My Friends Ages Program" using a string array structure at the declaration - Use assignment statements to store the following friend's ages - ages \( [0]=25 \) - ages[1] = 27 - \( \operatorname{ages}[2]=24 \) - ages[3] \( =26 \) - Use another for() statement to display each age stored in the array element - The end output should display both the message (use the puts() function here) and ages.


We have an Answer from Expert

View Expert Answer

Expert Answer


#include int main() { int i; int ages[4]; char message[20] = "My Friends Ages Program"; ages[0] = 25; ages[1] = 27; ages[2] = 24; ages[3] = 26; printf("%s\n", message); for(i=0; i<4; i++) { printf("%d\n", ages[i]); } return 0; } Explanation
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe