Created
March 20, 2017 16:18
-
-
Save AndyNovo/6c1d2b442f2a87cd545d3b0de508d042 to your computer and use it in GitHub Desktop.
Character Array basic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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