Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Created March 20, 2017 16:18
Show Gist options
  • Save AndyNovo/6c1d2b442f2a87cd545d3b0de508d042 to your computer and use it in GitHub Desktop.
Save AndyNovo/6c1d2b442f2a87cd545d3b0de508d042 to your computer and use it in GitHub Desktop.
Character Array basic
#include "stdio.h"
int main(void) {
char text[128] = "Andy is the greatest";
//Old fashioned C strings
//char is a one byte integer type used to store an ASCII character
// char text[128] declares an array of 'char's and = "..." initializes the values stored in that array
// after the "t" in greatest there will be stored a null byte (00000000) to indicate the end of the character array
printf("%s\n", text);
//The format flag %s will print out the entire character array as text
//this is the old fashioned version of a "string"
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment