Advertisement
artur99

Untitled

Dec 17th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. int main(){
  6.     char** string_list = (char**) malloc(12); //3 * 4 bytes
  7.    
  8.     string_list[0] = (char*) malloc(30); //30 bytes pentru text.
  9.     string_list[1] = (char*) malloc(30); //30 bytes pentru text.
  10.     string_list[2] = (char*) malloc(30); //30 bytes pentru text.
  11.    
  12.     strcpy(string_list[0], "Hello world!");
  13.     strcpy(string_list[1], "The brown fox.");
  14.     strcpy(string_list[2], "jumps over the lazy dog.");
  15.    
  16.    
  17.     printf("%c\n", string_list[0][0]);
  18.     printf("%c\n", *(string_list[0]));
  19.     printf("%c\n", (*string_list)[1]);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement