Introduction to Programming in C
Tags: c, hello, world, programming
Published: 2021-01-02 01:31:07

---
title: Introduction to Programming in C
published: true
description: Super basic blast through each line of your standard Hello World in C
tags: C, Hello, World, Programming
//cover_image: https://direct_url_to_image.jpg
---

# Introduction to Programming in C

This is designed to be a quick blast through "Hello, World" as well as primitive datatypes and variables. We'll add some more terms necessary to have discussions about programming as they are needed. I will make attempts to *italicize* special terms, such as *primitive*, *datatype*, and *variable*. Special terms to come include *function*, *method*, *data structure*, among others.

```
#include <stdio.h>

int main(int argc, char *argv[]) {
	printf("Hello, World!\n");
	return 0;
}
```

That's it. That is your basic "Hello, World" program in C. 

If you already know C, then it is clear what is happening here.

If you only know how to program in other languages, you can probably infer a lot about C syntax from this example.

However, if you don't know programming at all, then there are some basics that you need to pick up. The good news is that the basics picked up here can transfer into other languages as well.

So, whether or not you're an experienced programmer or a novice, I hope to convey or expose some new ways of thinking, and if not, then hopefully I am helping to reinforce things that you already know. 

-----

The first line is an `#include` statement, which is a command to the *C preprocessor*, a program that runs on your code first before it is actually compiled, that tells it to include code from the specified header file. In this case, it is "stdio.h", which is short for "standard input output". The .h means "header". 

The second line is the "main" *function* *declaration* and *definition*. Every program has a starting point, an entry point, and most of the time, it is going to be called "main". There are very slight exceptions to this rule, and many can be found in embedded programming. The *return type* of this function is *int*, short for integer, and its *parameters* are the "argument count" (argc) and the "argument vector" (argv). `argv` is an *array* of strings (char \*) passed in from the command line, or however your program is executed, and can be used to pass optional parameters to be processed by your program.

The third line, printf, is short for "print format". The string to be printed is "Hello, World", with a *newline* character at the end. Every *statement* ends in a semicolon (generally). 

The fourth line, "return 0", designates the end of this function and is returning 0, or our "success" value, to the calling program (wherever this program is ran).

The last line, a lone closing curly brace, designates the end of this function *definition*. 

-----

As I get started blogging again, expect the material-level to increase based on what I am comfortable writing about. I have been writing a lot of C lately for my game, so I felt like dumping out a quick, super-basic, intro to C. I hope you have enjoyed reading this, and look forward to more content in the future.