Bonjour,

Voilà mon erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x8f88340 (LWP 3494)] 0xb7e7470a in ?? () from /lib/i386-linux-gnu/libc.so.6
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
 
typedef struct
{
	char * key;
	char * value;
} stringPair;
 
int main(const int argc, const char * argv[])
{
char* list1;
char *key1;
stringPair * pPair1;
 
key1="";
key1="test";
list1="";
list1="bonjour";
pPair1=malloc(sizeof(stringPair));/*malloc(strlen(key1)+strlen(list1));*/
strcpy (pPair1->key,key1);
	strcpy (pPair1->value,list1);
fprintf(stdout, "%s and %s\n",pPair1->key, pPair1->value);
free(pPair1);
}
Donc je ne comprends pas pourquoi.

Merci.