-
To run C programs, we need a compiler
- clang and gcc are usually used on MacOS—they are built-in
- we can check if these compilers exist in our system by doing this on terminal:
gcc -v clang -v
- if they aren't found, we can install it by running: xcode-select --install
- https://www.youtube.com/watch?v=f0vVV4NPmjQ
-
To run a C program in VS code
- Install the 'C/C++' and 'code runner' extensions
- Write your C program and compile it by selecting Terminal > Run Build Task (choose gcc/clang build in the dropdown)
-
Pointers in C
- https://www.cs.fsu.edu/~myers/c++/notes/pointers1.html
-
int *p
,int* p
are the same - asterisk (*) used in the declaration statement is used to define the pointer variable
- asterisk (*) used elsewhere is used to dereference the pointer; for instance:
int x = 10; // * used here in the declaration statement has nothing to do with dereferencing; we are simply declaring a variable named aptr of type 'pointer to int' (meaning it stores the address of an integer variable) int *aptr = &x; printf("%x returns a memory address", aptr); // * here is now used for dereferencing printf("%d is the value dereferenced, *aptr);
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)