Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by Bartet ( 15 years ago )
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct
{
 char imie[21];
 char nazwisko[21];
 char akademik[22];
 int ocena;
} student_t;
typedef student_t *studentpr;

void main()
{
studentpr r;
r = (studentpr)malloc(sizeof(student_t));
strcpy((*r).imie, "bartosz");  //to samo: strcpy(r->name, "Leigh")
strcpy((*r).nazwisko, "nowak");
strcpy((*r).akademik, "babilon");
(*r).ocena=3;
(*r).ocena++;
printf("imie: %s\n",(*r).imie);
printf("nazwisko: %s\n",(*r).nazwisko);
printf("akademik: %s\n",(*r).akademik);
printf("ocena: %d\n",(*r).ocena);
free(r);
}

 

Revise this Paste

Parent: 42356
Children: 42410 42584 43347
Your Name: Code Language: