Question: in C language Write two statements to assign numApples with 10 and numOranges with 3. Sample output for given program: Apples: 10 Oranges: 3 #include
in C language
Write two statements to assign numApples with 10 and numOranges with 3. Sample output for given program:
Apples: 10 Oranges: 3
#include
typedef struct bagContents_struct { int numApples; int numOranges; } bagContents;
void bagContents_PrintBag(bagContents* itemPtr) { if (itemPtr == NULL) return;
printf("Apples: %d ", itemPtr->numApples); printf("Oranges: %d ", itemPtr->numOranges);
return; }
int main(void) { bagContents* groceryPtr = NULL;
groceryPtr = (bagContents*)malloc(sizeof(bagContents));
/* Your solution goes here */
bagContents_PrintBag(groceryPtr);
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
