Showing posts with label number. Show all posts
Showing posts with label number. Show all posts

Monday, January 28, 2013

Character Arrays in C++

This tutorial will show you how to use char (character) arrays in c++. In case you don't know, in the coding world there are strings of text, e.g.:

"Hello world!"

and these strings can be divided into arrays of characters:

'H' + 'e' + 'l' + 'l' + 'o' + ' ' + 'w' + 'o' + 'r' + 'l' + 'd' + '!'

Each character within a string, file, network packet, or etc. can easily be accessed individually if you use a character array:

charArray[0] == 'H'
charArray[1] == 'e'
etc...

In this tutorial, we will be making a program that will read an input file (which is expected to be a series of phone numbers separated by commas), go through each character in the file and make some changes, and then output the result to another file.