what is c programming language used for code example

Example: c programming language

// this is a single-line comment
/*
this is a multi-line comment!
*/

#include <stdio.h> // this library is included for i/o
#include <stdlib.h> // this library is included for some handy functions

// This function will be ran when the program executes
int main() {
 
  printf("Hello, world!\n"); // this prints "Hello, world!" [line break]
  
  char* myString = "An awesome string!"; // declare string variable!
  printf("%s\n", myString); // print myString where %s is
  
  int myInt = 10;
  printf("%d\n", myInt); // print myInt where %d is
  
  double myDouble = 5.2; // declare double (decimal) variable!
  printf("%f\n", myDouble); // print myDouble where %f is
  
  return 0; // < exit out of the program
}

Tags:

C Example