C Prog Week 10
C Prog Week 10
com/HWWkzXOgYld0esBGSYmFRT
1. D
2. B, D
3. -10
4. C
5. B
6. D
7. A
8. A
9. 6
10. 12
GRPA 1:
void writeToFile() {
char inputString[51];
if (file == NULL) {
exit(1);}
fclose(file);}
GRPA 2:
int countString() {
char s[20];
int flag = 0;
if (file == NULL) {
return -1;}
char bu er[256];
int count = 0;
count++;
pos += strlen(s);}}
fclose(file);
return count;}
GRPA 3:
void readFile()
FILE *file;
int number;
if (file != NULL)
printf("%d\n", number);
else
fclose(file);
}
GRPA 4:
if (fp==NULL){
return 0;}
int count = 0;
char c, prev_c;
if (
count++;}
prev_c = c;}
return count;}
GRPA 5:
#include <stdlib.h>
void findToppers() {
if (fp == NULL) {
return;
char line[100];
char name[51];
int score;
char toppers[100][51];
int topperCount = 0;
highestScore = score;
topperCount = 0;
strcpy(toppers[topperCount++], name);
strcpy(toppers[topperCount++], name);
}
fclose(fp);
printf("%s\n", toppers[i]);