Hirdetés
- Luck Dragon: Asszociációs játék. :)
- gban: Ingyen kellene, de tegnapra
- Mr Dini: Mindent a StreamSharkról!
- sziku69: Szólánc.
- sziku69: Fűzzük össze a szavakat :)
- nézzbe: AM3 hűtés s478-ra
- sh4d0w: Van-e még?
- Luck Dragon: Alza kuponok – aktuális kedvezmények, tippek és tapasztalatok (külön igényre)
- eBay-es kütyük kis pénzért
- joghurt: Megtarthatod a jogsid?
Új hozzászólás Aktív témák
-
Lortech
addikt
Minek utaztatod meg a stringeket?
Hiszen csak a char*-okra mutató pointereket kell kicserélni ahhoz, hogy **matrixban kialakuljon a helyes a sorrend:if (strcmp(matrix[i], matrix[j]) < 0)
{
char *sp = matrix[i];
matrix[i] = matrix[j];
matrix[j] = sp;
}De ha mégis úgy kéne, akkor pl :
#include <stdio.h>
#include <string.h>void rendez(char **matrix)
{
int i, j;
char ideiglenes[20]="";for(i = 0; i < 10; i++)
for(j = 0; j < 10; j++)
{
if (strcmp(matrix[i], matrix[j]) < 0)
{
strcpy(ideiglenes, matrix[i]);char *segedp;
segedp = (char *)realloc(matrix[i], strlen(matrix[j]) + 1);
matrix[i] = segedp;
strcpy(matrix[i], matrix[j]);segedp = (char *)realloc(matrix[j], strlen(ideiglenes) + 1);
matrix[j] = segedp;
strcpy(matrix[j], ideiglenes);
}
}
printf("\nRendezve: \n\n");
for(i = 0; i < 10; i++)
printf("%s\n",matrix[i]);}
int main(void)
{char *automarkak[10];
automarkak[0]=(char *)malloc(strlen("Mercedes") + 1);strcpy(automarkak[0], "Mercedes");
automarkak[1]=(char *)malloc(strlen("Ferrari") + 1);strcpy(automarkak[1], "Ferrari");
automarkak[2]=(char *)malloc(strlen("Audi") + 1);strcpy(automarkak[2], "Audi");
automarkak[3]=(char *)malloc(strlen("Lada") + 1);strcpy(automarkak[3], "Lada");
automarkak[4]=(char *)malloc(strlen("Chevrolet") + 1);strcpy(automarkak[4], "Chevrolet");
automarkak[5]=(char *)malloc(strlen("Ford") + 1);strcpy(automarkak[5], "Ford");
automarkak[6]=(char *)malloc(strlen("Ferrari") + 1);strcpy(automarkak[6], "Skoda");
automarkak[7]=(char *)malloc(strlen("Suzuki") + 1);strcpy(automarkak[7], "Suzuki");
automarkak[8]=(char *)malloc(strlen("Opel") + 1);strcpy(automarkak[8], "Opel");
automarkak[9]=(char *)malloc(strlen("Chrysler") + 1);strcpy(automarkak[9], "Chrysler");rendez(automarkak);
}
Új hozzászólás Aktív témák
Hirdetés
● olvasd el a téma összefoglalót!
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- 212 - Lenovo IdeaPad Slim 5 (16IMH9) - Intel Core U5 125H, no GPU
- 211 - Lenovo Legion 5 (15ITH6H) - Intel Core i7-11800H, RTX 3060
- 210 - Lenovo IdeaPad 5 Pro (16ARH7) - AMD Ryzen 7 6800HS, RTX 3050Ti
- 209 - Lenovo Yoga Pro 7 (14APH8) - AMD Ryzen 7 7840HS, no GPU
- 206 - Lenovo Legion Slim 7 (16IRH8) - Intel Core i7-13700H, RTX 4060
- BESZÁMÍTÁS! ASUS A320M R3 1200 8GB DDR4 370GB SSD GTX 1050Ti 4GB Zalman T3 Plus DeepCool 400W
- Apple iPhone 13 Pro 128GB, Kártyafüggetlen, 1 Év Garanciával
- ÁRGARANCIA!Épített KomPhone i5 14400F 32/64GB DDR5 RTX 5060 Ti 8GB GAMER PC termékbeszámítással
- Eredeti Lenovo 90W szögleges laptop táp + kerek átalakító egyben eladó
- Keresünk Galaxy S23/S23+/S23 Ultra/S23 Fe
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: Central PC számítógép és laptop szerviz - Pécs
Város: Pécs

