Facebook
From Sweet Hog, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 344
  1. #include <stdio.h>
  2. int main(int argc, char *argv[])
  3. {
  4.  int numbers[4] = {0};
  5.  char name[4] = {'a'};
  6.  // first, print them out raw
  7.  printf("numbers: %d %d %d %d\n",
  8.  numbers[0], numbers[1],
  9.  numbers[2], numbers[3]);
  10.  printf("name each: %c %c %c %c\n",
  11.  name[0], name[1],
  12.  name[2], name[3]);
  13.  printf("name: %s\n", name);
  14.  // setup the numbers
  15.  numbers[0] = 1;
  16.  numbers[1] = 2;
  17.  numbers[2] = 3;
  18.  numbers[3] = 4;
  19.  // setup the name
  20.  name[0] = 'Z';
  21.  name[1] = 'e';
  22.  name[2] = 'd';
  23.  name[3] = '\0';
  24.  // then print them out initialized
  25.  printf("numbers: %d %d %d %d\n",
  26.  numbers[0], numbers[1],
  27.  numbers[2], numbers[3]);
  28.  printf("name each: %c %c %c %c\n",
  29.  name[0], name[1],
  30.  name[2], name[3]);
  31.  // print the name like a string
  32.  printf("name: %s\n", name);
  33.  // another way to use name
  34.  char *another = "Zed";
  35.  printf("another: %s\n", another);
  36. MAIN
  37. PREVIOUS
  38. NEXT
  39. HELP
  40. Follow
  41. @lzsthw
  42.  printf("another: %s\n", another);
  43.  printf("another each: %c %c %c %c\n",
  44.  another[0], another[1],
  45.  another[2], another[3]);
  46.  return 0;
  47. }
  48.  

Replies to Untitled rss

Title Name Language When
Re: Untitled Obese Lion text 5 Years ago.