Új hozzászólás Aktív témák
-
Dirty_Pio
csendes tag
Na... kozbe rajottem egy-ket nagyobb hibamra, szoval igy nez ki a javitott kod:
#include <stdio.h>
#include <stdlib.h>
#define MAXST 20
#define MAXNL 50
struct student {
char *name;
float mark;
} ;
int getname(char *p)
{
int i=0;
char *q,c;
q=p;
while ( (c=getchar()!='\n') && i<MAXNL)
{
q[i]=c;
i++;
}
q[i]='\0';
return (i);
}
read_student ( struct student a[], int n)
{
char *p;
int i,e;
p=malloc(sizeof(char)*MAXST);
for (i=0;i<n;i++)
{
pritnf("\n the %i th student is:");
e=getname(p);
a[i].name=malloc(e*sizeof(char));
strcpy(a[i].name,p);
printf("\n mark for %s :",a[i].name);
scanf("%i",&a[i].mark);
}
free(p);
}
pritnstudnets(struct student a[], int n)
{
int i;
struct student *p;
p=a;
for (i=0;i<n;i++)
printf("%s\n",a[i].name);
}
int main(void){
struct student a[MAXST];
int nstdnt;
printf("students nr is:");
scanf("%i",&nstdnt);
read_student(a,nstdnt);
printstudenst(a,nstdnt);
return(0);
}A forditas elindul, de a lineker problemat talal a pritntf -ben a readstudent fuggvenyen belul, szovla mi a tehendom ?
Új hozzászólás Aktív témák
● olvasd el a téma összefoglalót!
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- A fociról könnyedén, egy baráti társaságban
- Robogó, kismotor
- Luck Dragon: Asszociációs játék. :)
- exHWSW - Értünk mindenhez IS
- Debrecen és környéke adok-veszek-beszélgetek
- Egyéni arckép 2. lépés: ARCKÉPSZERKESZTŐ
- Gaming notebook topik
- Forza sorozat (Horizon/Motorsport)
- Milyen nyomtatót vegyek?
- Milyen okostelefont vegyek? OFF topik
- További aktív témák...
- 0 perces COOLER MASTER 650W MWE V2 minőségi tápegység! GAR/SZÁMLA (Te nevedre)! 12V: 54A!
- AKCIÓ 03.30-ig!!! Intel Core ULTRA 5 225F +32GB DDR5 kit +hűtött VRM-es alaplap! GAR/SZÁMLA!
- AKCIÓ 03.30-ig!!! Intel Core ULTRA 5 225F +32GB DDR5 kit +hűtött VRM-es B860 lap! GAR/SZÁMLA!
- Canon RF 70-200mm f/2.8 L IS USM objektív - Újszerű -
- Apple AirPods Pro 1 (INGYEN FOXPOST)
- Lenovo T14S Thinkpad FHD IPS i5-1135G7 16GB RAM 256GB SSD Intel Iris XE Graphics Win11 Pro Garancia
- Lenovo T480S i5 8350U, 16GB RAM, 256GB SSD, jó akku, számla, 6 hó gar
- 512GB NVMe SSD, 1 év gar - 2230
- 27% - Philips Evnia 27M2N3200S IPS Monitor! 1920x1080 / 180Hz / 0.5ms / FreeSync
- 210 - Lenovo IdeaPad 5 Pro (16ARH7) - AMD Ryzen 7 6800HS, RTX 3050Ti
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
