Advertisement
Atdiy

Use of sizeof

Aug 11th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include "simpletools.h" // Include simpletools
  2.  
  3. int main() // main function
  4. {
  5. int p[] = {1, 2, 3, 5, 7, 11, 13, 17, 19, 23}; // Initialize the array
  6. for(int i = 0; i < sizeof(p)/sizeof(int); i++)
  7. {
  8. pause(500); // 1/2 second pause
  9. p[i] = p[i] * 100;
  10. printf("p[%d] = %d\n", i, p[i]); // Display array element & value
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement