Skip to content

Instantly share code, notes, and snippets.

@kgadek
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgadek/3b811b95bec888de00e4 to your computer and use it in GitHub Desktop.
Save kgadek/3b811b95bec888de00e4 to your computer and use it in GitHub Desktop.
#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