C
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
- voluntas
- @ignis_fatuus
- ブン
- @Linda_pp
- 清楚なC++メイドBOT
- @tzik_tack
- 長谷川一輝
- wraith13
- @jj1bdx
- @cpp_akira
- 安藤敏彦
- @srz_zumix
- Siv3D
- takezoh
- まろ
- @okdshin
- @hnokx
- @ishidakei
- @take_cheeze
- TAKEI Yuya
- @mumumu
- 黒澤 亮二
- I (@wx257osn2)
- @gnaggnoyil
- @mandel59
- Tommy6
- イズカワタカノブ
- @tyottyoworks
- ___shanon
- わたやん
- @KorekaraSEDB
- @kariya_mitsuru
- @ciniml
- @beam2d
- @grafi_tt
- @nekketsuuu
- LouiS0616
- @volanja
- 大鎌広
- むてら
- ガチKGB
x
62
*arrPersons = (Person*)realloc(*arrPersons, capacity*sizeof(Person));
1
2
3
4
5
int capacity;
6
7
typedef struct Person
8
{
9
char name[1024];
10
long id;
11
float age;
12
} Person;
13
14
int assignInputPeople(Person **arrPersons, FILE *inputPeople);
15
16
int main(int argc, char *argv[])
17
{
18
FILE *inputPeople = fopen(argv[1], "r");
19
Person *arrPersons = NULL;
20
if (assignInputPeople(&arrPersons, inputPeople) == EXIT_FAILURE)
21
{
22
return EXIT_FAILURE;
23
}
24
25
return 0;
26
}
27
28
void junk(){
$ gcc prog.c -Wall -Wextra -std=c89 -pedantic
Start
prog.c: In function 'main': prog.c:16:18: warning: unused parameter 'argc' [-Wunused-parameter] 16 | int main(int argc, char *argv[]) | ~~~~^~~~ prog.c: In function 'junk': prog.c:31:2: warning: unused variable 'arrPersons' [-Wunused-variable] 31 | *arrPersons = (Person*)malloc(10 * sizeof(Person)); | ^~~~~~~~~~ prog.c: In function 'assignInputPeople': prog.c:43:31: warning: format '%s' expects argument of type 'char *', but argument 4 has type 'long int *' [-Wformat=] 43 | sscanf(fileLine, "%s %s %s", arrPersons[counter]->name,&ID, | ~^ ~~~ | | | | char * long int * | %ld prog.c:43:34: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'float *' [-Wformat=] 43 | sscanf(fileLine, "%s %s %s", arrPersons[counter]->name,&ID, | ~^ | | | char * | %e 44 | &ageF); | ~~~~~ | | | float *
Segmentation fault
Finish