mirror of
https://github.com/Karmaz95/Snake_Apple.git
synced 2026-06-08 18:03:53 +02:00
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#include<stdio.h>
|
||||
|
||||
int main(){
|
||||
printf("main address : %p\n",&main);
|
||||
printf("printf address : %p\n",&printf);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main() {
|
||||
char buffer[10];
|
||||
strcpy(buffer, "Hello, World!"); // Vulnerable operation
|
||||
printf("You entered: %s\n", buffer);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface Person : NSObject
|
||||
@property NSString *name;
|
||||
@end
|
||||
|
||||
@implementation Person
|
||||
@end
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
@autoreleasepool {
|
||||
// Create a Person object
|
||||
Person *person = [[Person alloc] init];
|
||||
person.name = @"John Doe";
|
||||
|
||||
// The person object will be automatically managed by ARC
|
||||
NSLog(@"Person's name: %@", person.name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
// Allocate memory on the heap
|
||||
char *heapMemory = (char *)malloc(100 * sizeof(char));
|
||||
|
||||
if (heapMemory == NULL) {
|
||||
fprintf(stderr, "Memory allocation failed.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Memory allocated. Press Enter to exit.\n");
|
||||
|
||||
// Wait for Enter key press
|
||||
while (getchar() != '\n');
|
||||
|
||||
// Free allocated memory
|
||||
free(heapMemory);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("Hello, World!\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user