⚙️

C: Pointers, Memory & Syntax

75 cards · 🇺🇸 English

Core C syntax, pointers, and manual memory management.

Study all 75 cards for free

Flashcards, quizzes, pixel-art games and a daily review that remembers for you.

Study this deck free

Try the first 10 cards

1 / 10
Question

What was C originally developed for?

Knew itLearning

Tap the card for the answer · swipe right if you knew it, left if not

Already have an account? Sign in

Cards

  1. 1What was C originally developed for?
    Constructing utilities running on Unix and re-implementing the Unix kernel
  2. 2C's programming paradigm
    Multi-paradigm: imperative (procedural), structured
  3. 3C's type system
    Static, weak, manifest, nominal
  4. 4What language was C's successor to?
    B programming language (which was based on BCPL)
  5. 5Pointer in C
    A variable that stores the memory address of another variable
  6. 6Declare a pointer
    Use the * symbol: int *ptr;
  7. 7& operator
    Returns the address of a variable (address-of operator)
  8. 8NULL in C
    A pointer value that points to nothing (typically 0 or ((void*)0))
  9. 9Primitive integer types in C
    char, short, int, long, and their unsigned variants
  10. 10Floating-point types in C
    float, double, long double
  11. 11Sizeof
    An operator that returns the size (in bytes) of a data type or variable
  12. 12Allocate memory dynamically
    Use malloc(), calloc(), or realloc() from stdlib.h
  13. 13Free dynamically allocated memory
    Use free(pointer)
  14. 14What happens if you don't free allocated memory?
    Memory leak - the memory remains allocated and unavailable until program termination
  15. 15Memory leak
    When allocated memory is not deallocated, causing the program to consume more memory over time
  16. 16Dangling pointer
    A pointer that points to memory that has been freed or is no longer valid
  17. 17Declare an array
    type name[size]; e.g., int arr[10];
  18. 18Are array indices 0-based or 1-based?
    0-based - first element is arr[0]
  19. 19Relationship between arrays and pointers
    Array name decays to a pointer to its first element; arr[i] is equivalent to *(arr + i)
  20. 20Can you assign one array to another?
    No, arrays cannot be copied or compared directly - must use loops or library functions like memcpy
  21. 21Struct
    A user-defined data type that groups related variables of different types
  22. 22Access struct members
    Use dot notation: structVar.member or arrow for pointers: structPtr->member
  23. 23Union
    A data type where all members share the same memory location - only one member holds a value at a time
  24. 24Enum
    An enumerated type that defines a set of named integer constants
  25. 25Typedef
    A keyword that creates an alias for a data type
  26. 26Does C have a boolean type?
    C99 added _Bool (with bool alias via stdbool.h). Before that, int was used (0=false, non-zero=true)
  27. 27Does C have a string type?
    No built-in string type - uses null-terminated character arrays (char arrays ending with \0)
  28. 28Main function
    An int value (0 typically indicates success, non-zero indicates error)
  29. 29Two standard main function signatures
    int main(void) or int main(int argc, char *argv[])
  30. 30Argc
    Argument count - the number of command-line arguments

And 45 more cards. Study the whole deck free

Articles about this deck

More Programming decks

See all
Study all 75 cards free