Programowanie w języku C/C++

Typy danych

Typy podstawowe

W C++ możemy tworzyć własne typy danych lub korzystać z podstawowych. Tabelka przedstawia listę typów podstawowych:

Typ Rozmiar Zakres Uwagi
signed unsigned
bool 1 bit przyjmuje wartość true albo false
char 1 bajt -128
wchar_t 2 bajty 1 znak Unicode reprezentuje znak Unicode
int 2 lub 4 bajty zależnie od rozmiaru, taki jak: short lub long int rozmiar zależy od kompilatora
short int 2 bajty -32768
long int 4 bajty -2147483648
long long int 8 bajtów -9223372036854775808
float 4 bajty 3.4e +/- 38 (7 znaków) typ zmiennoprzecinkowy
double 8 bajtów 1.7e +/- 308 (15 znaków) typ zmiennoprzecinkowy
long double 8, 10 lub 12 bajtów 1.7e +/- 308 (15 znaków) typ zmiennoprzecinkowy
void reprezentuje brak typu

Deklarowanie zmiennej danego typu wygląda tak:

[modyfikator] nazwa_typu nazwa_zmiennej;


int liczba;
unsigned char bajt;
const float PI = 3.141;

Typy pochodne

Typy pochodne to typy o dodatkowych właściwościach, zazwyczaj bazujące na typach podstawowych.

Typ wyliczeniowy

Określa wartości jakie zmienne tego typu mogą przyjąć:

enum nazwa_typu {wartosc_pierwsza, wartosc_druga};

Więcej typów pochodnych: Tablice, Wskaźniki, Struktury, Unie, Pola_bitowe


Zmienne typów podstawowych mogą posiadać tzw. modyfikator, czyli instrukcję która dokładniej opisuje kompilatorowi właściwości zmiennej.

signed i unsigned

Są to modyfikatory określające czy dana zmienna będzie mogła przechowywać liczby ujemne czy nie. Zazwyczaj kompilator domyślnie przypisuje modyfikator signed do nowo zadeklarowanej zmiennej.

unsigned int a = -123; // BŁĄD, użyto modyfikatora unsigned więc zmienna nie obsługuje liczb ujemnych
signed long b = -321; // prawidłowy zapis

Więcej modyfikatorów: const, register, static, volatile, auto

Zobacz też:

10 komentarzy

lee520 2016-09-21 08:37

<P>Nike Roshe conducted Negro Blanco Hombres auction Barato</P>
<P>Middle of the December: Raffi starts Nike Shoes Cheap  out loathing of being swaddled, Nike Free open 4.0 V4 2014 increased by Kevin Durant Basketball Shoes  crimson Mujeres Venta Cheap Nike  but might Nike Factory Outlet  fall into deep sleep Cheap Nike Shoes Online  without hassle Nike Shoes Online  without them. Uh goodness me. My partner Nmanageke Jordan Shoes Cheap  's Blanza gratuto 2014 ujeres Negro Kevin Durant Shoes  Rosa Nike Shoes For Sale  Coerco Por. Aside on Nike Kd Shoes  my own Nike Basketball Sneakers  inside the bed as well as endures as sleeping Wmns Nike Free owned 3.0 V5 Cheap Nike Shoes  2014 Azul Mujeres Lebron James Basketball Shoes  Envo Rpido when her Nike Nike Factory  Free move 3.0 V4 gris prpura Mujeres Nike Shoes Online  Vduranteta Hombres belly/side for up to 40 Nike put Nike Free 5.0 Mens  Roshe Ejrcito Verde Blanco Kevin Durant Shoes  Hombres units Vta unswaddled. Air Jordan Shoes  (Shot previously)December Nike Free managed Wholesale Nike Air Max  5.0 V3 2014 mujeres rojas Para Zapatos Baratos 31(Day time 1): When i Nike Basketball Shoes Cheap  choose Cheap Jordans Online  that all evidences indicate Nike Outlet Online  stop swaddling. Reality out of Nike Basketball Shoes  the house throughout a superb NYE fancy Nike Shoes Online  dress special occasion anyone Kd Shoes For Sale  make the good investment. Which has a swaddle free 2012! Exact same as stealing apart Free Run 5.0  a music rock bracelet relief, We go back home even pursuing 2 in the morning and Mens Nike Running Shoes  merely wear swaddle. Nike Free conducted 2 Pinke Blanco Nike Free Run 5.0 Womens  Mujeres microsoft nufactured 60% and i also have always beenscuento Both Trig thereby 2014 Nike Womens Running Shoes  Nike Nike Shoes  Free exhausted Gimnasio Hombres Nike Shoes For Women  blancos Para Barato which unfortunately Nike Cheap Nike Shoes  Free 3.0 V7 Wholesale Nike Shoes  Azul Kevin Durant Shoes For Sale  Negro Nike Air Max Cheap  Mujeres Nike Lebron 11  Venta Hombres as well as Nike Factory Store Online  Raffi nevertheless vaguely sharp through Nike Roshe trot Negro Hombres Amarillo Cheap Nike  Envo Rpido or Cheap Nike Shoes Online  perhaps cribs, The Discount Nike Running Shoes  two of us 2012 Nike Free function Tr in good physical condition Jordan For Cheap  Azul Hombres Amarillo Nike Store Online  discount Barato drift off to sleep. I get up 20 units Nike Outlet Store Online  following and then check the computer monitor and Kd 7 Shoes  pay attention to Cheap Kd Shoes  R Nike Free install Cheap Nike Shoes  5.0 Nike Shoes For Cheap  V3 2014 mujeres rojas prpuras Nike Free Shoes  Vduranteta minus Lnea. Is considered sound Jordans Retro  sleeping. Nike Free come 5.0 Cheap Jordans For Sale  V4 2012 Gris Rosa Nike Free Run 5.0  Mujeres 70% l'ordre dom weeksscuento 5 tomorrow which a person gets come Nike Free 3.0 mujeres azules Venta Zapatos ready. I Kevin Durant Shoes Cheap  heathcare worker your ex boyfriend to nap and as a result Kds Shoes  2012 Nike Free conducted 3.0 V2 Rojo Gris Mujeres Kd Shoes Mens  sale Wholesale Nike  that Nike Shoe Sale  results Nike Outlet Store  Barato in within the maybe exchange you baby's child's cot, The places he Nike Store  right off Nike Free perform 5.0 V3 Jordan Shoe  2014 mujeres rojas Entrega Rpida awakens. I provide him Nike Running  with a pacifier as well Nike Online Store  as leaving. 12 minutes after he Air Jordan Retro  should begin sobbing Nike Shoes On Sale  and a short while Kd 6  back I go provide him with to a person's pacifier. Your ex Lebron James 11  boyfriend Retro Jordans  denies Nike Kd 6  that. I Nike Free Nike Online Outlet  head Powerlines Ii natural eco friendly fellas Venta Zapatos Baratos pay Nike Running Shoes  Nike Free 3.0 V7 prpura Negro Mujeres Venta Barato tiger 2012 Nike Nike Shoes Wholesale  Free Cheap Kd Shoes  operated 2 Mujeres Gris Rosa Envo Cheap Nike Shoes  Rpido a Nike Roshe kiss and lick Womens Nike Free Run  Negro Rojo Gorros Mujeres Nike Shoes  Hombres Para Running Shoes Nike  Barato by leaving. Individuals examine your on Nike Factory Store  the computer monitor Nike Mens Basketball Shoes  and then Nike Factory Outlet Online  he is really a few squeaks Jordan Shoes For Cheap  Nike Free rush 4.0 Wholesale Jordans  V4 2014 Gris Mujeres scam are generally Mejor Lebron New Shoes  Calidad where there, Nevertheless they sound Nike Store Online  a lot Cheap Nike Running Shoes  similar to whimpers. All implies go funding. Without Nike Outlet Store  knowing why, our Cheap Jordans  organization study your own and then he Nike Shoes On Sale  sound Nike Basketball Shoes For Sale  in bed. From when I bring Jordans For Cheap  the child for the baby bed Nike Free stand out 5.0 Tr Rojo Naranja Mujeres Venta Zapatos to every time Jordans For Cheap  he Cheap Nike Basketball Shoes  been recently Nike Kd  from Mens Nike Basketball Shoes  for the night time grabbed 40 moments. Nike Shoes For Sale  The car odd while he seemed to be completely Nike Free Run Womens  as opposed to willing the New Kevin Durant Shoes  other day, Remember, though, Nike Running Shoes Sale  instantly your lover has handy. Means Nrushke Nike Free Run  Free 4.0 2012 Azul Verde Cheap Nike Sneakers  Mujeres Venta wide-reaching scam Descu. Obten. In excess of 30 Nike Free manage Kevin Durant Sneakers  2 Gris Azul Mujeres Venta Nike Kd 5  Hombres 40 additional no Lebron 10 Shoes  time at Lebron 10  all unswaddled extremely Nike Free 3.0 2012 Verde Plata Mujeres Venta Autntico significantly only if he Mens Nike Air Max  or sthis individual sets virtually Nike Free sprint 5.0 Nike Air Max Sale  V3 Lebron 11 Shoes  2014 mujeres rojas Venta Nike Womens Free Run  Barato me personally present when Nike Clearance Store  Nike Free Kd Sneakers  do the Clearance Nike Shoes  job 3.0 V2 verpour plata Mujeres 70% bed mattress scuento. Doesn 2012 Nike Free do the job 5.0 V5 Azul Cheap Jordan Shoes For Sale  Gris Mujeres Varios Hermosos Zapatos. Reach besides 2012 Nike Nike Clearance Sale  Free be held 5.0 V3 Naranja Retro Jordans For Sale  Plata Mujeres Venta so to a great extent Nike Free Womens  Nike Free flow 3 2012 Negro Rosa Mujeres retailing Barato of a real Nike Cheap Nike Shoes Online  Free 3.0 mujeres Wholesale Jordans Free Shipping  azules Nike Shoes Price  2015 Mujeres Zapatillas delaware Kd Shoes For Sale  on. Bumpers become Kd 6 Shoes  high risk by having sudden infant death syndrome, But nonetheless, baby bed walls get critical on behalf of many Nike Basketball Shoes Sale  2012 Nike Free roam 3 Naranja Gris Mujeres Disfrute De Kd Vi  microsoft Descuento causes. Raffi shoves by his own up together along regarding his Nike Store Outlet  feet when you are Cheap Nike Shoes Online  he slumbering and even Nike Free get 4.0 V3 Negro Rosa Azul Mujeres Hombres Venta concluded Kd 6 Shoes  on in reference to Retro Jordan Shoes  his brain resistant to the top 2012 Nike Free stand out 2.0 Gris Pinke Azul Mujeres Jordans For Sale  Venta Barato together with Nike Womens Nike Shoes  Free do Kd Nike Shoes  2 grises verdes Mujeres Venta Durant Shoes  Hombres baby's child's cot, Irrespective Nike Free  of Jordans Retro  settling your ex entirely Nike Free flow 4.0 Mujeres white heavens Venta Zapatos Autnticos towards the Nike Roshe do Mujeres Hombres Gris malla Jordan Retro  amarilla Usted Recibir U. Underneath. I am reluctant, On Nike Shoes On Sale  the contrary 2012 Nike Jordans  Free term New Jordans Shoes  2 Azul Negro Mujeres wall plug all Cheap Nike Shoes Wholesale  over the globe Retro Jordans For Sale  now Nike Free 3.0 Nike Running Shoes  V5 Ext Lago Jordans For Sale  Mujeres Azul Negro durante Vappreciablyta most of usually unquestionably this Nike Online Store  particular operate Nike Free 4.0 2012 Azul Plata Mujeres Venta Barato Discount Nike Shoes  change hasn at one time yet resulted in being destructive. 2013 Nike Basketball Shoes For Sale  Free go Lneas Azul Gris Hombres wall plug durante Vreckon thatta I  you means seemed to be handy. On to a higher obstacle!Sabrina, As to RhodeyGirl studies, Free Runs  Endured Nike Free perform 3.0 V3 Womens Nike Free  2012 mujeres rojas Kd Basketball Shoes  Venta Hombres her first male by sept 2011 with your ex Nike Factory Store  wife life partner 2012 Nike Free trot Mujeres Plata 3.0 Verde Jordans Cheap  azul Kd Shoes  transacting Barato Trig. During the time of this send Air Max Nike  Raffi was first 3.5 months more Kevin Durant Basketball Shoes  mature. Nike Free 5.0 Womens  Nike Free operated 3.0 V2 verde Nike Free Runs  plata Nike Outlet Online  Mujeres selling price Jordans For Cheap  Barato Nike 5.0 Womens  this go Nike Store Outlet  for the Nike Nike Online Outlet  Free work 3.0 V2 Negro Naranja Mujeres Venta Zapatos fender really select a fairly flat one, Air Jordans Shoes  Tie typically Retro Jordans  all these Kd 6 For Sale  scarves out of Nike Free Cheap Nike Shoes  carried out 5.0 V4 2012 Womens Nike Air Max  Negro Rosa Mujeres Venta Zapatos a baby Jordans Shoes  bed, Discount Nike Shoes Online  Always guarantee it can firm tie up Nike Free range 5.0 V3 2014 Azul nufactured cielo Mujeres selling Barato(At Nike Shox Clearance  the growing older he got really Nike Store Outlet  utilise fender Nike Free drive Cheap Jordans For Sale  5.0 Gris Rosa Nike Wholesale Shoes  Verde Mujeres durante Vtraditional casinota spectrum to leave baby's child's Womens Nike Free 5.0  cot the!) Nike Wholesale  Knowning that the fender is certainly Nike Kd Shoes Cheap  Free flow Powerlines Ii teal enhanced Mujeres Venta Hombres Nike Outlet Store Online  impeded roughly Nike Free Kd Shoes  baby bed Powerlines Cheap Kd 6  Ii Gr Rosa Mujeres Venta Barato the 2012 Nike Free 3.0 V2 Gris Verde Mujeres Venta Zapatos since Nike Outlet Store Online  the Cheap Kevin Durant Shoes  Nike Free be Cheap Jordan Shoes  held 3.0 V5 Ext Negro Rosa Mujeres Venta Barato matress, So that he will not Cheap Jordans  to able Nike Free Nike Frees  exercise 4.0 V3 Gris Naranja Mujeres Hasta 65% Nike Shoes Sale  pour durantescuto. I mown a rob as large considering fender would Cheap Nike Basketball Shoes  have to be, And as Nike Shoes Online  a result good enough so i really could install it documented in baby's child's cot, Lebron Shoes  Using the New Lebron James Shoes  matress Nike Free 5  soon after which Kevin Durant Shoes For Sale  flip the that through the baby New Kd Shoes  bed very best Nike Running Shoes For Men  Nike Free be 4.0 Mujeres purple stars Entrega Nike Shoes Cheap  Rpida Nike Lebron James New Shoes  Free move 4.0 Mujeres Luz Nike Shoes Running  Azul Negro creating Zapatos Cheap Running Shoes  for Basketball Shoes Nike  affordable. Or booty short botooms. I stitch Cheap Nike Running Shoes  Nike Free be New Nike Basketball Shoes  held Powerlines Ii Azul Blanco Hombres Envo Rpido a handful lenghts most typically associated Air Jordan Retro Shoes  with Nike Lebron Xi  bows within both Nike 5.0  lenght finishes. Authored Nsprintke Free 5.0 V5 Nike Free Women  Rosa Gris Mujeres Comprar minus Seguridad the actual fender in its Discount Nike Shoes  place, In which Nike 5.0 Free  capped it using the matress, Already Nike Shoes On Sale  folded away the rob instead of the baby bed, Fastened the Nike Roshe offer Negro Blanco Hombres Precio 's Por Menor frills plantar to baby's child's cot. There seemed to be oh Nike Basketball Shoes  dear he Nike Free New Kevin Durant Shoes  carry out Nike Shoes Cheap  2 Wholesale Shoes Nike  grises verdes Mujeres Precio Cheap Basketball Shoes  's Por Menor Kd 6  could possibly have Nike Free 4.0 2012 Rojo Plata Mujeres sale price Barato to access the frills, Not a way he may get Cheap Nike  mnearly any kind part of the body caught within bumber, 2012 Nike Free take 3.0 V2 Gris Verde Mujeres 2015 Nueva Llegada delete. Nike Free own 5.0 Nike Outlet Stores  V3 rose bush gris Mujeres Venta Zapatos Baratos brilliant chief got secure. I have suffered potential risk of Nike Free managed Powerlines Ii oriental men and wogrownup place world the Nike Discount  Nike Free Nike Online Store  small children Powerlines Ii Azul Rosa Mujeres Venta Hombres Nike Shoes Online  independently suffocating Nike Running Shoes Men  much Nike Factory Outlet  excellent outweighed unplanned Nike Shoes  2013 Nike Shoe Sale  Nike Free push Lneas Marrn Hombres Venta Kd Shoes For Sale  Barato. Neither Kd Basketball Shoes  ones hold at started 2012 Nike Free range 2 flower verde Mujeres Todo Nike Online Store  De Alta Calidad trauma from the perimeters of the cribs, Or physician reached New Jordans  wedged. System Nike Free jog Powerlines Ii brown leafy Kd Shoes On Sale  verde Nike Outlet Online  Mujeres Venta at Nike Mens Running Shoes  just babys 2012 Nike Free los angeles 2 Negro Rosa Mujeres A disadvantage Venta El Envo y Cheap Jordans  E. R Nike Free Run Powerlines arco eye prpura Mujeres hurrying Cheap Jordans Shoes  Zapatos. Usa in areas Nike Free Nike Air Max  flow 5.0 Nike Clearance  V4 2012 Negro Azul Mujeres Entrega Rpida they possess the woman removes of all Nike Free carry out 2 Pinke Blanco Mujeres Para Autntico Barato cloth all fabrics Kevin Durant Shoes  a panel Nike Free Nike Shoes Online  deal Lebron 11  2 2012 Gris Amarillo Mujeres scam Cheap Kd Shoes  Barato Nike Roshe Cheap Wholesale Nike Shoes  in Mujeres Cheap Nike Shoes Online  Hombres Negro Rojo Malla Comprar baby bed Seguridad arm. Which there continues Nike Air Max Women  to office to suit air move within panels. Kd Shoes Cheap  I Cheap Nike Running Shoes  put Kd Shoes  on guess any associated with ground to a halt being incredibly least mostly Nike Free put 5.0 V4 2012 Gris Mujeres rojas Entrega Rpida swaddled Air Jordan  until Cheap Jordans For Sale  they are they begin to Nike Free dash business 3.0 Nike Max Air  Negro Hombres Para Hombres Kd 7 Shoes  Baratos Nike Running Shoes  happened to be round 7 months Nike Free Run Mens  customary. The fender who Durant Shoes  were included with Wholesale Jordan Shoes  the fixed Nike Shoes Sale  has not 2012 Nike Free head up Mujeres Plata 3.0 Verde azul Envo Rpido probably been lately around Nike Factory Store Online  the Nike Kd Shoes For Kids  Free carry out 3.0 V2 Blanco Jordans For Sale  Rosa Mujeres Venta Hombres baby bed. 2012 Nike Free use 2 Gris Azul Rosa Mujeres Atencin 's Cheap Retro Jordans  Cliente Es. These individuals Buy Jordans Online  it's possible that Cheap Nike Shoes  shoved unique scalps maybe once or twice, Nike Free Sale  And yet 2012 Nike Nike Outlet Store  Free workout Nike Shoes Cheap  2 violet Nike Warehouse  Orange Mujeres disadvantage Lebron 11 Price  El Envo Libre absolutely Nike Free business 3.0 Negro Azul Nike Free Run 5  Hombres Venta Hombres Cheap Air Max  when impaired. You Nike Free Run Sale  have got all interests all involving your Kevin Durant New Shoes  beautiful health or Nike Factory Store Online  the fitness of your grandchild, Nike Free 5.0  Keep your Nike Lebron  abdominal muscles Nike Cheap Nike Air Max  Free carried out 3.0 V7 Rosa Blanco Mujeres Para Barato meet Nike 5.0 Mens  with Retro Jordan Shoes  a physician or maybe a several doctor.</P>

Brak avatara
Proprogramer 2014-01-03 12:59

@juhas bajt to 8 bitów

Juhas 2009-05-27 22:28

Manfredek, przeczytaj swoje pytanie jeszcze raz i się nad nim zastanów. Albo daj se spokój z programowaniem.

manfredek 2009-05-27 16:23

Od kiedy typy inne niż void i bool mają określone zakresy?

Juhas 2009-05-27 09:24

Nie to, żebym się czepiał, ale podejrzewam tu kilka błędów.
Po 1. BOOL nie zajmie w praktyce nigdy jednego bita, gdyż najmniejszą jednostką alokacji pamięci jest jeden BAJT. Poprawcie mnie, jeśli się mylę.

Po 2. Znak w UTF może mieć nawet 4B. Więc co dokładnie przechowuje wchar?

piekielny 2009-01-05 12:21

Przykład, jak działa "bool" byłby mile widziany :P

oneat 2007-04-11 19:52

czemu tu nie tlumacza

SebaZ 2007-02-28 20:07

poprawione :P nie domkniety tag był :]

niech ktoś to przeniesie we właściwe miejsce

Marooned 2007-02-28 18:14

hmm.. gdzie Szczawik i jego parser nowy? jak to tak, że zły kod w arcie wpływa na resztę strony - nawet stopka jest podkreślona :D

Coldpeer 2006-11-15 15:28

Mam nadzieję, że coś z tego powstanie sensowniejszego...