Answer the following true/false questions using the code that follows. You must correctly state WHY your answer is true or false in order to receive credit.
# include
# include
# include
#define SIZE 4
typedef struct dessert{
char size;
float price;
charflavor[20]:
int available;
}dessert;
void give info(dessert *des, int size, char filename)
{
FILE *fp=fopen(filename,"r");
char *token;
char line[40];
int i
for(i 0:i {
fgets(line, 40, fp);
token-strtok(line,"":
des[i].size=token[0];
token strtok(NULL,".");
des[i.price-atof token);
token strtok(NULL,",");
strcpy(des[i].flavor,token):
token strtok(NULL,"n)
desi available-atoi(token);
}
fclose(fp):
}
void print report(dessert "d, int size)
{
int i
printf(nCURRENT INVENTORY: n");
for(i 0 i {
printf(" Info for Item %d \n", (i+ 1));
printf("Size: %<\n", (*d)size);
printf(" Price: 962f\n", ("d).price);
printf(" Flavor: %s\n", (*d) flavor);
printf("Ava ili blity: %d\n\n", ("d).available);
d ++:
}
}
int main (int argc, char "argv)
{
int num-atoi(argv1);
dessert "des (dessert)malloc(sizeof dessert) num):
if(des-=NULL)
{
printf ("Error getting you some memory! Bye.In");
}
else
{
give jinfo(des, num, argv[21):
print report(des, num):
}
free(des):
}
True / False:
1) The function printf is defined in this program.
2) stdio.h is the function that allows us to output to screen.
3) This code includes one header and two preprocessor directives.
4) argc is a function.

Respuesta :

Answer:

1. False

2. True

3. False

4. False

Explanation:.

1. The function printf is not defined in the program.

The header file stdio.h contains only the declaration or prototype of the functions like printf

Since the header file stdio.h is not included in the program then printf is not declared.

2. Stdio.h is the function that allows us to output to screen

stdio.h is a header file in C, it is the file which contains C declaration and Macro definition to be shared between several files. stdio.h means standard input/output function which contains printf(), scanf() functions.

It is the header file for standard input and output. This is useful for getting the input from the user(Keyboard) and output result text to the monitor(screen)

3. The code includes no header file and two preprocessor directives

There's no header file in the program

The two preprocessor directives in the program are #include and #define

4. argc is not a function; it is a variable of type integer.