Warning: Declaration of action_plugin_subjectindex_indexer::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/subjectindex/action/indexer.php on line 15

Warning: Declaration of action_plugin_mathjax_enable::register(Doku_Event_Handler &$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/mathjax/action/enable.php on line 62

Warning: Declaration of action_plugin_googleanalytics::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/googleanalytics/action.php on line 40

Warning: Declaration of action_plugin_folded::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/folded/action.php on line 40

Warning: Declaration of action_plugin_hidden::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/hidden/action.php on line 28

Warning: Declaration of action_plugin_include::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/include/action.php on line 354

Warning: Declaration of action_plugin_tag::register(&$contr) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/tag/action.php on line 175

Warning: Cannot modify header information - headers already sent by (output started at /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/subjectindex/action/indexer.php:15) in /data/web/virtuals/28604/virtual/www/subdom/bo/inc/auth.php on line 532

Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /data/web/virtuals/28604/virtual/www/subdom/bo/inc/auth.php on line 818

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /data/web/virtuals/28604/virtual/www/subdom/bo/inc/parser/handler.php on line 1376

Warning: Declaration of SI_EntryDefault::match($text) should be compatible with SI_Entry::match() in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/subjectindex/plugins/EntryDefault.php on line 68

Warning: Declaration of SI_EntryTag::match($text) should be compatible with SI_Entry::match() in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/subjectindex/plugins/EntryTag.php on line 42

Warning: Declaration of SI_EntryVerse::match($text) should be compatible with SI_Entry::match() in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/subjectindex/plugins/EntryVerse.php on line 1280

Warning: preg_match(): Compilation failed: invalid range in character class at offset 4360 in /data/web/virtuals/28604/virtual/www/subdom/bo/inc/parser/lexer.php on line 118
A PCRE internal error occured. This might be caused by a faulty plugin

Warning: Cannot modify header information - headers already sent by (output started at /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/subjectindex/action/indexer.php:15) in /data/web/virtuals/28604/virtual/www/subdom/bo/inc/actions.php on line 215
jazykc:jednorozmerna-pole [Bo.bule]

====== Jednorozměrná pole ====== * [[dox>jednorozmerna-pole/obraceni-pole.c|Obrácení_pole]] * [[dox>jednorozmerna-pole/eratosthenovo-sito.c|Eratosthenovo_síto]] * [[dox>jednorozmerna-pole/aritmeticky-prumer-pole.c|Aritmetický_průměr_pole]] Pole je homogenní (všechny prvky mají stejný typ) datová struktura s přímým přístupem k jednotlivým prvkům. Pole má úzký vztah s [[ukazatele|ukazateli]] ======Deklarace pole====== Bez inicializace (obecně): typ_pole identifikátor[velikost_pole]; kde * //typ_pole// je datový typ prvků v poli a * //velikost_pole// kladná celočíselná konstanta udávající maximální počet prvků v poli. Příklad: <code c> int moje_cisla[10]; /* pole 10 čísel typu int */ </code> S inicializací (obecně): typ indentifikátor[velikost] = {prvek_1, ..., prvek_N}; kde navíc //prvek_1// až //prvek_N// udávají inicializační hodnoty prvních N prvků pole (N je menší nebo rovno velikost). Pokud chceme vytvořit pole přesně pro inicializací daný počet hodnot, nemusí být velikost uvedena. Příklady: <code c> int cisla[5] = {1, 2, 3, 4, 5}; int cisla[] = {1, 2, 3, 4, 5}; char str[] = "Ahoj svete"; /* textový řetězec je pole znaků */ char ach[] = {'0', '1', '\0'}; /* textový řetězec je pole znaků -- je to složitější */ </code> ======Přístup k prvkům====== K jednotlivým prvkům pole přistupujeme pomocí operátoru indexu [ ] uvedeným za identifikátorem pole. Uvnitř závorek operátoru je pak potřeba uvést celé číslo odpovídající indexu prvku v poli. V jazyku C je pole indexováno od 0, tj. první prvek pole má index 0, poslední N-1, prvek[N] neexistuje!!! Příklad: <code c> int i; int pole[10]; for (i = 0; i < 10; i++){ pole[i] = i+1; } for (i = 0; i < 10; i++){ printf("%i, ", pole[i]); } </code> ======Textové řetězce====== Textové řetězce jsou v jazyku C reprezentovány jednorozměrnými poli znaků ukončenými znakem s nulovou hodnotou '\0'. Z tohoto důvodu musí být velikost pole rovna délce odpovídajícího řetězce zvětšené o 1. Pole znaků definujte vždy takto: <code c> char buffer[100+1];//100+1 sečte kompilátor </code> Standardní funkce pro práci s textovými řetězci jsou k dispozici v knihovně [[:c:string.h]]. ---- cc, upol


Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /data/web/virtuals/28604/virtual/www/subdom/bo/inc/auth.php on line 818
jazykc/jednorozmerna-pole.txt · Last modified: 2015/01/15 20:47 (external edit)
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0