C Foundation Review

2022. 4. 8. 23:22Coding - C

# include <stdio.h>

       .h = header file, which means the most used, basic, applies to every code

       stdio: the default functions such as printf, scanf, etc.

 

int main(void){

       return 0;

}

      main = 함수, function, the file that the computer searches first, tells that most of the functions are going to start              here.

      void = empty, nothing is in here

This is counted as an interger, and since it is empty, we return 0 at the end. So the function, y = f(x), the x is the int, and return 0; is the y.

 

FOR LOOPS

       First is the interger that we are going to start with, the second is the conditional, the third is the stepping value per         loop or the limit.

 

RANDOM

       The time(0) function resets the time and show the current time, and since time differs, the value that it will give also differs. However, to print a different value every time, srand() is needed, as seed random, setting the initial value. *ld = long interger.

 

Star pyramid Code: 

#include <stdio.h>
int main (void){
int i,j;
int n = 5;
for (i=0;i<n; i++){
for (j=0;j<n-1-i; j++){
printf(" ");
}
for (j=0;j<i*2+1; j++){
printf("*");
}
printf("\n");
}
return 0;
}

DO NOT SET THE LIMITS: THE BOUNDARIES ARE SET BY ME, AND TRY TO THINK AS WE ARE VISUALISING. 

'Coding - C' 카테고리의 다른 글

Data Types and Operators  (0) 2022.05.07
Kernel and the C  (0) 2022.04.22
Binary Notation & Conversion, Bits and Bytes  (0) 2022.04.15
Interpreter VS Complier  (0) 2022.04.01
Before Coding...  (0) 2022.03.12