Last active
August 29, 2015 14:19
-
-
Save kgadek/3b811b95bec888de00e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdio> | |
#include <cstring> // tutaj jest zdefiniowany `strcpy` i `strncpy` | |
using namespace std; | |
struct osoba{ | |
char imie[20]; | |
char nazwisko[20]; | |
int wiek; | |
char plec[10]; | |
}; | |
int main(){ | |
osoba mama; | |
osoba tata; | |
osoba corka; | |
strncpy(mama.imie, "Ala ma kota, niemniej kot ma 'ale' i spuścił jej za to łomot. A w sumie to ten napis jest całkiem długi, ma więcej niż 20 znaków", 19); | |
strncpy(tata.imie, "Grzegorz", 19); | |
tata.imie[19] = '\0'; | |
mama.wiek = 10; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment