C Programming - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

C Programming

Description:

Machine code that is generated by compilers and assemblers ... The rand() function. Random number generator, which generates integers in the range [0,RAND_MAX] ... – PowerPoint PPT presentation

Number of Views:59
Avg rating:3.0/5.0
Slides: 8
Provided by: mah138
Category:
Tags: programming | rand

less

Transcript and Presenter's Notes

Title: C Programming


1
C Programming
  • Mahsa Eshraghi

2
What is GCC?
  • GCC is the compiler system for
  • Unix-compatible operating system.

3
What is Relocatable Object Code?
  • Machine code that is generated by compilers and
    assemblers and stored in relocatable object files
    or .o files.

4
The printf() function
  • Printf or print-formatted
  • Print(..Hello world)
  • Print(Integer d, someInteger)
  • main ()
  • printf ("Astronomy is d derful \n",1)
  • printf ("And interesting d \n",2)
  • Output
  • Astronomy is 1derful
  • And interesting 2

5
The rand() function
  • Random number generator, which generates integers
    in the range 0,RAND_MAX
  • To generate a random floating point in the range
    0,1) (including 0, not including 1) use
    r(  rand() / (RAND_MAX1.0) )
  • To generate a random integer in the range 0,6)
    r 6.0( rand() / (RAND_MAX1.0) )
  • To generate a random integer in the range 1,7)
  • r 1 6.0( rand() / (RAND_MAX1.0) )

6
Local and Global Variables
  • Local
  • main()
  • int i4
  • i
  • Global
  • int i4
  • main()
  • i

7
Global and Internal variables
  • int i4 / Global definition /
  • main()
  • i / global variable /
  • func
  • func()
  • int i10 / Internal declaration /
  • i / Internal variable /
Write a Comment
User Comments (0)
About PowerShow.com