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> | |
typedef struct { | |
void* start_address; | |
void* end_address; | |
size_t offset; | |
size_t size; | |
size_t pointer_location; |
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> | |
typedef struct { | |
void* start_address; | |
void* end_address; | |
size_t offset; | |
size_t size; | |
size_t pointer_location; |
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
/** | |
* Tests different type of initializers in jvm: | |
* 1) <clinit>: stands for class or the static initializer, called only once on the first reference of the class name. | |
* 2) <init>: is the class object initializer or the instance initializer called whenever creating a new object and it resembles the class constructor. | |
* | |
* @author pavl_g | |
*/ | |
public class TestInitializers { | |
static class TestClassInitializer { | |
public static int len = 00; |
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
/** | |
* @brief Tests using pointer operations on a data structure to evaluate its members. | |
* | |
* @author pavl_g | |
*/ | |
#include <stdio.h> | |
struct Test { | |
int x; | |
int y; |
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> | |
int* mat_add(int*, int*, int); | |
int* mat_add(int* a, int* b, int enteries) { | |
// enteries * 4 = 2 * 4 = 8 bytes | |
int* summation = (int*) calloc(enteries, sizeof(int)); | |
for (int row = 0; row < enteries; row++) { | |
for (int column = 0; column < enteries; column++) { |
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(void*) { | |
/* create an array of strings (arrays of characters) */ | |
/* This buffer is allocated in contigous memory chunks */ | |
const char credentials[][255] = {"Andrew", | |
"ZirqfRopWpedsS0012#24"}; | |
/* get an element from the 1st dimension */ | |
const char* user_cred = credentials[0]; /* or use *(credentials + 0) */ |
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(void*) { | |
const char* user = "Andrew"; | |
const char* passwd = "ZirqfRopWpedsS0012#24"; | |
/* create a pointer to strings (notice, we are just creating references here) */ | |
const char* credentials[] = {user, | |
passwd}; | |
/* get an element from the 1st dimension */ |
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> | |
/** Header file */ | |
typedef struct { | |
int rows; | |
int columns; | |
} StarMatrixMetadata; | |
void print_star_matrix(StarMatrixMetadata metadata); |
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> | |
/* define a non-system-specific pointer type that can hold an address of up-to 8-bytes */ | |
typedef long long jlong; | |
jlong Java_util_getAddress() { | |
int* x = malloc(sizeof(int)); | |
*x = 2312; | |
void* address = x; |
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
import java.util.ArrayList; | |
class TestSuperCapture { | |
static class TestSuper {} | |
static class TestSub extends TestSuper {} | |
static class TestSub2 extends TestSub {} | |
static class TestSub3 extends TestSub2 {} | |
public static void main(String[] args) { |