C Programming Tutorial For Beginners

Program though if I wanted to enter in a celebrity with who only had one name so if I only wanted to enter in one the program actually isn’t.

Going to be able to handle that so if I said like hats and down here if I said like Gandhi and I click enter you’ll notice that it’s still waiting for me to enter.

In a last name right so I could enter in something here and then the program will work but it was.

Waiting for me after I entered in just that one name so that’s something that you’re gonna have to you know play around with in your programs basically C is gonna force you to be very specific about what the user is entering so if the user needs to enter two things like two words and you need to specify that if the user is only going to enter in one word you have to specify that so.

You have to be very specific when you’re getting input from the user like that in this tutorial I’m gonna talk to you guys about.

Using a raisin seed a lot of times when we’re writing our C programs we’re gonna be dealing with a bunch of different data and one of the things we can do to control and manage and sort of keep track of and organize that data is put data inside of things called arrays an array is really useful because it’s basically a container where we.

Can store a piece of information but what happens in your programs when you’re dealing with huge amounts of information specifically huge amounts of information that are related right imagine I had a list of like a bunch of names or a list of a.

Bunch of numbers that I needed to keep track of let’s say I had like a list of a hundred numbers right I wouldn’t want to have to create a hundred different variables to store all of those different numbers and this is where arrays come in an array is essentially a data structure where we can store a bunch of different data values so inside of an array.

Unlike a variable where I can only.

Store one value I could store hundreds or thousands or even millions of values so.

Inside of a single array I could store like five things or seven things or ten numbers or twenty characters you know.

Sort a bunch of different pieces of information and then all that information would be nice and neat and organized in my program so I’m gonna show you guys how to create arrays we can create an array a lot like we create a normal variable and a variable in array are very similar variable is.

Basically used to define a container that stores a single value and an array is used to define a container that stores you know any number of values so the first thing we’re gonna have to do when we create an array is give C some information and the first piece of information is.

What type of data we want to store inside of the array so for example I could say int and now I’d be creating an array that would hold integers.

If I said char I’d be creating an array that would hold characters or if I said like double the same thing but for double numbers so why don’t we create an array of integers and I’m just gonna.

Call this lucky numbers whenever I create an array I always want to use a special little symbol and this symbol will tell see that instead of just creating.