Guest User

C♭

a guest
May 25th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.28 KB | None | 0 0
  1.  
  2. // single line comment
  3. /* multi
  4.  
  5. line
  6.  
  7. comment*/
  8.  
  9. /*
  10.     constants are typed values that can't be changed and
  11.     must be initialized. Their address can't be taken.
  12. */
  13. const int ANSWER = 42;
  14.  
  15. /*
  16.     variables are a typed mutable value.
  17.     It's declaration consists of a type and a name
  18.     and may also define an initial value.
  19. */
  20. int variable;
  21. int variable = 10;
  22. int variable = 0x10;
  23.  
  24. /*
  25.     variables may also have a storage class
  26.     specifier that defines where the variable is
  27.     stored and how it's memory is shared.
  28. */
  29. private int variable; // one per instance
  30. static  int variable; // one per thread
  31. private static int variable; // one per instance and thread
  32. global  int variable; // one per process (default)
  33. shared  int variable; // one per executing system
  34.  
  35. /*
  36.     methods are declared by a type and a name
  37.     followed by an argument list enclosed in
  38.     round brackets.
  39.  
  40.     parameters are separated by commands are are
  41.     declared ba a type followed by the parameter
  42.     name.
  43.  
  44.     each method header declaration must follow a method
  45.     body enclosed in curly brackets.
  46.  
  47.     each method can be exported by placing an 'export'
  48.     keyword in front of the method header.
  49. */
  50. int main()
  51. {
  52.     return 1;
  53. }
  54.  
  55. int square(int i)
  56. {
  57.     return i * i;
  58. }
  59.  
  60. export int sum(int a, int b)
  61. {
  62.     return a + b;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment