Starting The Coding With C Language
C language is very huge programming language you can do almost everything. If we want to give example what we can do with C language , we can create mobile apps , games even you can code robot so C language has a lots of features. In university , They teach C language first , reason of this making understandable algorithms , I mean C language is very understandable and simple.
In this essay , I will talk about the C language’s features and we will make simple console apps. Firstly we will make very simple console apps , we will press “Hello World” on the screen and I will try to explain through codes.
#include <stdio.h> int main() { printf("Hello World"); return 0; }
Writing with the C language we have to know some basic words ;
#include <stdio.h> : With this expression (include) we can add the library what we wanna do easily , I mean if we wanna do some mathematical process we can add math.h library and we can do more easily. Stdio.h is a library which we can do output and input process.
int main() : In this expression interval we can press the own words on the screen with printf or functions.
printf () : With this expression interval we can print the words or phrases on the screen.
scanf () : With this expression we can get word,numbers or sentences etc. from the user.
return 0 : When the program see this expression , program will be finish .
Output files of the above codes is below.
Now , I will write code which wanna ask the number from user. Before making program we also know the some meaning of words ;
int : Integer. We get the integer number and press the screen using %d symbol.
float : Float . We get the float numbers and press the screen using %f symbol.
double : With this expression we can get ınteger and float numbers and press the screen using %lf symbol.
& : With this expression we can get numbers or sentences from the user and this expression keep them like when we ask the number to user we can get this number using this expression(&numbers).
char : Character. We get the character %c symbol.
string : With this expression we get the sentences and press the screen using the %s symbol.
#include<stdio.h> int main() { int sayi; printf("Enter a number"); scanf("%d",&number); printf("You entered %d " , number); return 0; }
Output is below ;
Enter a number : 49 You entered 49