Advertisement
LightProgrammer000

MAtriz [Linha - Coluna - Elementos]

Dec 1st, 2018
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. // Programa LEVEL B //
  2.  
  3. // Biblioteca
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. int main()
  8. {
  9.     int i;
  10.  
  11.     /*
  12.     [4]  -> LINHA
  13.     [2]  -> COLUNAS
  14.     [11] -> ELEMENTOS (Quantidade de caracteres)
  15.     */
  16.  
  17.     char president[4][2][11] = {"George", "Washington",
  18.                                 "John", "Adams",
  19.                                 "Thomas", "Jefferson",
  20.                                 "James", "Monroe"
  21.                                };
  22.  
  23.     /*
  24.                 COLUNA 0        COLUNA 1
  25.     LINHA 0     George(6+1)     Washington(10+1)
  26.     LINHA 1     John(4+1)       Adams(5+1)
  27.     LINHA 2     Thomas(6+1)     Jefferson(10+1)
  28.     LINHA 3     James(5+1)      Monroe(6+1)
  29.  
  30.     OBS.: Toda "String" na - Linguagem C - tem o elemento de caractere nulo "\0"
  31.     */
  32.  
  33.     for( i = 0; i < 4; i++ )
  34.     {
  35.         // Saida de dados: Linha[Mutável] Coluna[0] --- Linha(Mutável] Coluna[1]
  36.         printf("\n %-10s %-20s", president[i][0], president[i][1]);
  37.         putchar('\n');
  38.     }
  39.     return(0);
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement