Anasayfa » C / C++

C / C++ Courses ? 1 (Introduction to C)

19 Temmuz 2010 1.898 views 2 Yorum

Let’s start with memories. There are two kinds of memory:

  1. Temporary Memory: Also called “Primary Memory“. When we say temporary memory, RAM comes to our minds. It contains little space, but it is expensive.
  2. Permanent Memory: Also called “Secondary Memory“.You know this is related to Hard Disc. It needs more space, but it is cheaper than temporary memory.

This theoratical information is enough for now. Let’s make a quick start to programming. The basic terms that a C Program should have, are like that:

#include<stdio.h>

int main(){

//Our program will be here

return 0;

}

Let’s learn what they exactly mean:

#include<stdio.h>

"#include <>" is a preprocessor directive. Preprocessor directives are not program statements but directives for the preprocessor. These lines are always preceded by a hash sign (#). The preprocessor is executed before the compilation begins, so the preprocessor digests (compiles) all directives before any code is generated. No semicolon (;) is expected at the end of these lines. Shortly, these lines are used for including and adding contents.

"stdio.h" is a header file. “stdio” represents “Standard Input/Output”.   “.h” is used for “header file”. All library functions in C are declared in header files. These functions are predefined. Therefore, programmers have to include the stdio.h header in order to use the functions declared in it.

int main()

Everything which has parantheses “()” is a function in C.But main function is a special function in C.

  • If you don’t have a main function, your program will give an error.
  • Every program should have a main function.
  • Main function is the place where execution starts.

{ ..codes here..}

Every part which stays between these two curly brackets is called block.

return 0;

Every program consists of statements. Statement is a line of code which ends with a semicolon (;) . As you can see , “return 0; ”  is a statement too. But it is a special one. It is placed at the end of the main function, also it is the end of execution.

This was the introduction part. Hope to meet next course, see you 🙂

2 Yorum »

  • müjde dedi ki:

    bence çok güzel bir giriş olmuş,böyle devam tatlım 🙂

  • Ziynet dedi ki:

    çok teşekkürler canım:)

Yoruma Açığız! :)

Be nice. İçeriği çirkin olmadığı sürece her yoruma, öneriye ve soruya "evet" :)

Etiketler: , , , , , , , , , ,