O GoConqr está de visual novo! Conte para nós o que você achou.

Mapa mental

Progamming C

Blue .DEAN Computer Science Inglês

Conteúdo do mapa

Progamming C

  1. The source code directives and library,and both of them are called header file. The function main() necessarly comes after ways begins with preprocessor the directives

    • The preprocessor is a program which works before the operation of compilation. And it reads these first ligns (directives). We use the function main because it begins working as soon as the code is executed.
    • For exampe : stdio.h et stdlib.h
      • these are librairies which allow the computer to insert text easily.
  2. The source code always should finish with return 0

  3. The function main contains insides it a range of instruction, which the computer reads. And begins and finishes with curly braces to determine the start and the ned of the function

    • 1.The backslash n \n is for the escape 2.The backslash t \n is for tab  3.The semi-colon should be indicated at the end of every statement 4.output by printf can have two or more arguments. The arguments are the output string + format specifiers or conversion specifiers The arguments = colons+1
    • Basic functions: Input/Ouput
      • \n new line  \t horizontal tab  \\ backslash  \b backspace  \' single quote  \" double quote
      • Input
        • A format specifier = %[*][max_field]conversioncharacter Conversation Character can be : d decimal  c  character s string f float x hexadecimal * is like a command to skip that specifier and go the next, but the specifier will be for the first variable.
        • getchar
          • This function returns the first character the user clicks on SYNTAX #include<stdio.h>  int main() {    char a = getchar();     printf("You entered: %c", a);    return 0; }
        • gets
          • This function used to get a sequence of characters: string SYNTAX #include  int main() {     char a[100];     gets(a);      printf("You entered: %s", a);     return 0; }
        • scanf
          • scanf() scans input that matches format specifiers The & sign before the variable name is the address operator. It gives the address, or location in memory, of a variable. This is needed because scanf places an input value at a variable address
      • Output
        • Format Specifier = %[-][width].[precision]conversioncharacter
        • putchar
        • puts
        • printf
  4. Variables

    • A variable is a name for an area in the memory The name of the variable is called identifier. It can begin with a letter or a letter, and can be composed of letters, digits or underscore
    • We should declare them first and then give them a value
      • If we would like to be a constant, we add 'const' before the type and the name of the variabe. We name it depending on their purpose and their representation.
  5. Data types

    • Integers
      • 2 bits %d
    • Double
      • 4 bits scan %f print %lf
    • Floats
      • 8 bits
    • Characters
      • 1 bit %c
    • Strings
  6. Errors

    • Syntax error
    • Faulty error
  7. Loops

    • The statements break and continue are useful in loops. break is to exit the loop. Meanwhile, continue is to skip an iteration  EXAMPLE int num =5;  while(num>0){ num--;     if (num==3) continue ;  printf("%d\n", num); } the output is 421 int num =5;  while(num>0){num--;     if (num==3) break ; num--;  printf("%d\n", num); } the output is 5 4
    • For
      • The for statement is a loop structure that executes statements a fixed number of times. counting loops only For( declare the variable; the condition; the counter++or--){} Also, you can skip the initvalue, condition and/or increment. #include int main() {    int i=0;    int max = 10;      for (;i < max; i++) {        printf("%d\n", i);    }}
    • While
      • While is called a loop structure because it executes statements repeatedly while an expression is true, looping over and over again. the condition and then what will happen while(condition){ the counter  what will happen }
    • Do while
      • The do-while loop executes the loop statements before evaluating the expression to determine if the loop should be repeated. this one: what will happen and then verifying the condition do{the counter;what will happen}while( the condition);
  8. Selection

    • if /else if/ else
      • If statement is called a conditional control structure because it executes statements when an expression is true. For this reason, the if is also known as a decision structure. The expression evaluates to either true or false, and statements can be a single statement or a code block enclosed by curly braces { }.
    • switch
      • swithch(experssion) { case constant 1: break; case constant :break;default:break; }
  9. Constant

    • const int  CONT; write const the type of data and the identifier. And constants should be initialized as they are declared Another way to make a constant is to use the preprocessor directive #define The #define directive uses macros for defining constant values. A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro
  10. Operators

    • During the operations of different types of data. For example, if we add and an int to a float, we do it this way: the type of the int type data becomes a float, either by: Type conversion : automatically becomes a float  or Type casting:  writing (float) before teh varibale EXAMPLE #include<stdio.h> int main() {     float average;     int total = 23;     int count = 4;     average = (float) total / count); printf("%4.2f", average);      return 0; } ***Without the type casting, average will be assigned 5.***

Informações

Descrição
Computer Science Mapa Mental sobre Progamming C, criado por Blue .DEAN em 04-07-2021.
Criado por
Blue .DEAN · jul 2021
Atualizado
24 nov 2021
Visualizações
0
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?