This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main () { | |
// You can declare a struct Node with: | |
// struct Node { | |
// int data; | |
// struct Node* next; | |
// }; | |
// However, we use: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int add (int a, int b) { | |
printf("%d + %d = %d\n", a, b, a+b); | |
} | |
int main () { | |
// Function pointer declaration (and assignment) | |
int (*fp)(int, int) = &add; // Can also be assinged to just 'add' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void dodgyIncrement (int s) { // Copy of myScore passed to function | |
s++; // Local copy incremented, myScore stays the same | |
} | |
void increment (int* s) { // Pointer to address of myScore passed to function | |
(*s)++; // Value of variable at address is incremented, brackets prevent incrementation of pointer itself | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main () { | |
char* str = (char *) malloc(sizeof("string")); // Allocate memory for string literal | |
strcpy(str, "string"); // Copy literal into allocated memory | |
printf("str = %s, address = %u \n", str, str); // Print string and address | |
free(str); // Deallocate memory | |
printf("str = %s, address = %u \n", str, str); // Print string (should be blank) and address (should be the same) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bacon ipsum dolor amet sausage meatloaf pork loin, drumstick rump ham hock ball tip hamburger sirloin flank turducken venison frankfurter pork ham. Boudin landjaeger kielbasa beef ribs swine turkey short loin shankle pork chop salami turducken prosciutto frankfurter tri-tip tenderloin. Pastrami fatback flank drumstick bresaola prosciutto chuck. Shankle rump tail, chuck shank capicola kevin meatloaf flank tri-tip doner ham sirloin leberkas. Capicola salami ball tip venison rump kevin corned beef prosciutto bacon. Alcatra swine short loin corned beef, short ribs tongue bresaola capicola cupim pork brisket pork belly pork chop. Bacon landjaeger andouille tri-tip, brisket tail cow porchetta chicken ball tip ham turkey. | |
Pastrami alcatra beef ribs chicken. T-bone ham porchetta beef ribs cupim. Jowl frankfurter prosciutto, cow chicken boudin pastrami ribeye kevin corned beef brisket swine doner ham hock. Doner jowl picanha filet mignon. Beef ball tip doner, turkey cupim tail pork belly pork drumstick. Bresaola jerk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec commodo odio convallis tincidunt varius. Integer interdum erat augue, eget auctor lacus mollis sit amet. Fusce neque tellus, dignissim vel mi aliquet, rhoncus semper felis. Vestibulum commodo eget ante quis auctor. Curabitur eu metus sit amet lorem aliquet luctus. Vestibulum vestibulum feugiat nisl, tincidunt dignissim diam mattis fermentum. Curabitur non consequat turpis. Integer pretium felis id felis porta, consequat blandit massa fermentum. | |
Etiam ac arcu eget ipsum lacinia fringilla. Aliquam aliquam rhoncus bibendum. Morbi vehicula vulputate tempus. Aliquam luctus sapien sit amet ante mollis ultrices. Sed vel diam nec libero pharetra tincidunt in nec sapien. Aliquam finibus, justo porta ultricies bibendum, eros magna egestas metus, non mollis ligula magna quis diam. Suspendisse potenti. Nunc ac metus id tortor vestibulum egestas ac quis sapien. Donec molestie lorem elit, ac lacinia augue faucibus eu. Nullam non volutpat massa. Duis in felis a |