Notas
C Programming
Conteúdo das notas (1)
Página 1
Basics of C Programming:
#include <stdio.h> //A link to an external library file that handles standard input/output
int main(void) //A necessary function in every C program
//"int" means that this program must return an integer value
{
int aNumber; //An integer variable
printf( "Please enter a number: " ); //Display a message on the screen
scanf( "%d", &aNumber ); //Receive and store the value entered by the user
printf( "You entered %d", aNumber ); //Display feedback to the user about the recent input received
getchar(); //A "trick" to prevent the program window from closing by waiting
//for an additional character to be typed
return 0; //0 means execution was successful and the operating system is now informed
}
-printf () is used to display a message to the user
-scanf() is used to scan an input given by the user
Directives:
used to import libraries. There are 2 ways of doing this:
1) #include <package name>---- Used to refer to standard headers available with C
2) #include "package name"------ Used to refer or import user created headers or code
3) #define name ----- used to define a macro or a constant eg: #define BUFFER_SIZE 1024
Informações
- Descrição
- Notas sobre C Programming, criado por amey mhaskar em 03-11-2018.
- Criado por
- amey mhaskar
- Visualizações
- 0
- Avaliação
Mais sobre C Programming Basics