Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <string.h>
- #include <math.h>
- int main()
- {
- char movie1[] = "The Return of Bucky Dude!";
- char * movie2 = "The Wolfman from Dirt Swamp!";
- // array names are constants, can’t be changed
- // array names point to the first elements address
- // can't put arrays on the left hand side of an equals sign
- // changing it will mess up the entire array, won't know where any other elements are
- // to change it, we need to use strcpy() or change each individual element
- // movie1 = "hey now";
- // movie1[] = "hey now";
- // you CAN put pointers on the left hand side
- // movie2 can't hold characters or strings, only addresses
- // C is going to put the string into memory somewhere, and then give you it's address
- // just saying start at this address, end when it gets to null 0
- movie2 = "brown cow";
- // now we can work with strings, just like they are any other variable!
- puts(movie1);
- puts(movie2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment