From: ktopatan@worldbank.org
Date: Mon 03 Feb 2003 - 17:10:44 EET
scanf() satirin soyle olmali:
scanf("%s", text);
referans'a gerek yok cunku "text" zaten adres belirtiyor.
k,
|---------+----------------------------------->
| | Bora Tuncer |
| | <bora_tuncer2000@yahoo.c|
| | om> |
| | Sent by: |
| | linux-baslangic-bounce@l|
| | inux.org.tr |
| | |
| | |
| | 02/01/2003 05:17 PM |
| | Please respond to |
| | linux-baslangic |
| | |
| | |
| | |
|---------+----------------------------------->
>--------------------------------------------------------------------=
-----------------------------------------------------------|
| =
|
| To: Linux-Baslangic@Linux.Org.Tr =
|
| cc: =
|
| Subject: [linux-baslangic] gcc --- ufak bir hata =
|
| =
|
>--------------------------------------------------------------------=
-----------------------------------------------------------|
selam arkada=FElar
a=FEa=F0=FDdaki kodu derleyip =E7al=FD=FEt=FDrd=FD=F0=FDmda
/tmp/we_1006/we_sys_tmp : Line 1: 1352 Segmentation
Fault $*
gibi bir hata veriyor.Kodumda pointer tipi yerine
text[150] gibi bir string kulland=FD=F0=FDmda d=FCzeliyor ama
ben kodumda pointer kullanmam laz=FDm(strlen vs.. gibi
nedenlerden)
bu konuda sizlerin yard=FDmlar=FDn=FD bekliyorum
//-------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *text,a;
int i,j,sayac=3D0,temp;
int dizi[100][3];
text=3D(char*) malloc(150);
printf("Huffman Coding =D6rnegi\n");
printf("Text : ");
scanf(stdin,"%s",&text);
//dizideki t=FCm frekanslar sifirlaniyor
for(i=3D0;i<100;i++){
dizi[i][1]=3D0;
}
dizi[0][0]=3Dtext[0]; //dizinin ilk eleman atani=
yor ve
baslangic frekansi bir yapiliyor
dizi[0][1]=3D1;
sayac=3D1;
printf("%s\n",text);
for(i=3D1;i<strlen(text);i++){
printf("%d---",sayac);
for(j=3D0;j<sayac;j++){
temp=3Dtext[i];
if(temp=3D=3Ddizi[j][0]){
dizi[j][1]++;
break;
}
}
if(j=3D=3Dsayac){ // eger daha =F6nce
karsilasilmis bir frekans yoksa
dizi[j][0]=3Dtemp;
dizi[j][1]=3D1;
}
sayac++;
}
for(i=3D0;i<sayac;i++){
// printf("%c - %d ",dizi[i][0],dizi[i][1]);
}
a=3Dgetc(stdin);
return 0;
}
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
-----------------------------------------------------------------------=
Liste =FCyeli=F0iniz ile ilgili her t=FCrl=FC i=FElem i=E7in
http://liste.linux.org.tr adresindeki web aray=FCz=FCn=FC kullanabilirs=
iniz.
http://www.linux.org.tr/listeler.php sayfasina bakiniz.
Listeden =E7=FDkmak i=E7in: 'linux-baslangic-request@linux.org.tr' adre=
sine,
"Konu" k=FDsm=FDnda "unsubscribe" yazan bir e-posta g=F6nderiniz.
-----------------------------------------------------------------------=
=
-----------------------------------------------------------------------
Liste üyeliğiniz ile ilgili her türlü işlem için
http://liste.linux.org.tr adresindeki web arayüzünü kullanabilirsiniz.
http://www.linux.org.tr/listeler.php sayfasina bakiniz.
Listeden çıkmak için: 'linux-baslangic-request@linux.org.tr' adresine,
"Konu" kısmında "unsubscribe" yazan bir e-posta gönderiniz.
-----------------------------------------------------------------------