C-notes-Input-Output-Print.txt

  1. What is the condition for a while loop to go until the input is a new line?
    ( (c = getchar() ) != '\n' )
  2. What is the condition for a while to loop until EOF?
    ( (c = getchar() ) != EOF)
  3. What is the format for a do while loop?
    do{ } while (condition);
  4. star pointer returns what?
    The values stored at the location
  5. pointer returns what?
    The address location
  6. What is the name of the default variable storage class?
    auto
  7. What is name of storage class which memory alloc remains after block ends?
    extern
  8. What type of storage class retains it's prevous value?
    static
  9. How do I print a floating point # in scientific notation?
    %e, %E
  10. How do I print a decimal with at least 3 digits, filled in w/ leading zeros.
    %03d
  11. How do I print a pointer address?
    %p
  12. How to print a string?
    %s
  13. How to left justify a printed value?
    - ie. %-s
  14. How to print a tab?
    \t
  15. For printing, what is the layout code?
    width.precision
  16. How to print 0004.50
    %07.02f
  17. What is the function to generate a random number?
    srand(int seed)
  18. What returns the current time?
    time(time_t tp)
  19. How do you initialize a file pointer?
    FILE *name;
  20. How do you open a file?
    fopen("string.txt", "r")
  21. What is the condition to check for a null pointer
    (pointer == NULL)
  22. How do you scan a file?
    fscanf(filePointer, "%d", &value)
  23. How do you change the buffer of scanf?
    setbuf()
  24. How do you print to a file?
    fprintf(filePointer, "%d", value)
  25. How do you close a file?
    fclose(filepointer)
  26. How do you clear the buffer?
    fflush(filePointer);
  27. How do you write to standard error?
    fprintf(stderr, "message %s", string)
  28. How do you write to binary files?
    fwrite()
  29. How do you read from binary failes?
    fread()
  30. How do you find out how many bytes from start is filepointer?
    fseek(filepointer)
  31. How do you offset the filepointer in bytes?
    fseek()
Author
kariefury
ID
41324
Card Set
C-notes-Input-Output-Print.txt
Description
input output
Updated