Tumgik
captainhumboog-blog · 6 years
Text
Diving into the Deep, Blue C!
Wassup people? Sorry, it has been ages, everything has got in the way, and my stupid procrastinating brain has tried its best to stop me from writing and just learn the language, which will probably be better but meh. Today I have started to properly dive into C. I have learned how to create a string and an integer variable and I have also been concatenating strings in print statements using %s and %d. Today’s code goes as follows:
int main(){ char planetName[] = "Earth"; int population = 750000000; printf("Hello, %s! %d people are online.", planetName,population); return 0; }
In C, %s is used to concatenate a string, and %d is used to concatenate a numeric value (Or so I believe). After I finish this program and get the result “Hello, Earth! 750000000 people are online.”, I start on the topic of Data Types.
There are 3 data types that I know of in C, int, char, double, and technically a string, which as I have mentioned before is an array of characters, and is defined like
char stringName[] = “string contents”;
Comments are handy lines of code that are used for writing things that will not be executed by the compiler. They are used like: /* Comment Here */ , /* Code */ , etc.
0 notes
captainhumboog-blog · 6 years
Photo
Clever!
Tumblr media
Keep going!
Also, click the image! It’s transparent!
92K notes · View notes
captainhumboog-blog · 6 years
Text
Hello, World!
Hi. I am back already. I am going to start learning C today, and I am following a video by https://freecodecamp.com, which seems to be going good so far. I have checked I have a compiler on my Macbook using the command cc -v and just incase you do not have a C compiler on your Mac, run xcode-select --install this should install your C compiler.
For the next thing I am going to need to do, I am going to have to install an IDE (Integrated Development Environment) to edit and debug my code. Yes, I could use the terminal but it tends to get messy. A popular editor for C/C++ is CodeBlocks. For some reason, it is already installed on my machine, but if it isn’t on yours go to http://codeblocks.org/, it is free and open source, meaning that it can be used on Mac, Windows and Linux.
My first project is going to be a “Hello, World!” program. I created a Console Application in C, of course, and then tried building the default “Hello, World” program. I made the mistake of calling my project “Learning C”, using a space in my project name, so when it tried executing the command it taken “C” as an argument, instead of the filename. To fix this if you get the error, instead of spaces use an underscore (_), or even better, use Camel Case (But if you use CamelCase, don’t forget to use a capital at the start for objects and file names, unless you want a band of coders raiding your home!).
So, after I had recreated my project, I get going. I #import <stdio.h> and open up int main(). I then write a statement to output text to the console, which is printf("Hello, World!\n");. Take note of the semicolon (;) at the end and the “\n” at the end of the print statement. The semicolon signifies a line’s end, I am not quite sure why it is required in some places and not others or why it is needed at all, but I know it is needed - It is like a full stop, you need it at the end of a sentence.
The next lines are as follows:
   return 0; }
Since this function is an int(), it is expected to return an integer, in this case we return 0, and the closing curly bracket closes the function, signifying the end.
Anyway, I think that is enough for today, I am really tired after school, but I will see you in the next post!
PS: Please don’t forget to correct me in comments or ask me questions in the “Ask me anything” box on my page.
0 notes
captainhumboog-blog · 6 years
Text
Imma try getting into Game Development.
I have decided that I am going to try to learn Game Development by the end of the year. There, that is what I am going to try and learn. I do have experience in Java, Javascript, Python and some Lua; so getting to grips with programming logic shouldn’t be an issue. But I do want the experience of building Desktop games that people can relate to and that is a way of expressing my views and opinions, despite what 2018’s society says is “politically incorrect” or “sexist”. It may seem anarchic, although I believe the best way to help bring back a decent, civilised, real-world society is to express your personal opinions, not have them censored by almost every media platform on the internet (*cough* *cough*, YouTube).
I want to get into game development so that I can express my political and feelings about people and society in an entertaining way. I may not have any concrete ideas on what game I could make, how it would entertain my ideas in an acceptable and wanted way, or even getting it out to people in the first place.
I think that I am going to learn the basics of C, just enough to make a simple terminal application or GUI app, and then I will get onto Unity 2D with C#. I want to practice C# as much as I can after C, until I can make a simple Ketchapp-like game where you tap to turn left or right and gradually speed up.
I don’t like setting expectations on posts and videos as I rarely tend to fulfill the expectations I built. However I am going to try and update you all at once (or more) a week. If you would like to follow along and have this almost like a tutorial, I will try to explain everything as thoroughly as possible, but as time goes on I think I’ll explain less and less just to help people from copying identically and to allow them to figure things out for themselves. And let’s face it, if you get into some form of software/development job, chances are that no random teenager is going to be blogging how to do your job.
I hope to see you all in the next post!
4 notes · View notes