This file contains 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
//----------------------------------------------------------------------------- | |
// Project 3 Userspace code. | |
//----------------------------------------------------------------------------- | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define __NR_sys_get_addr 360 | |
int main(int argc, char* argv[]) |
This file contains 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> | |
#define __NR_sys_get_addr 360 | |
struct data | |
{ | |
int aval; | |
long address; | |
}; | |
int main(int argc, char* argv[]) | |
{ |
This file contains 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 <linux/syscalls.h> | |
#include <linux/kernel.h> /* Needed for KERN_INFO */ | |
#include <linux/list.h> | |
#include <linux/printk.h> /* Needed to print to the kernal log file */ | |
#include <linux/mm.h> |
This file contains 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
/* Side effect, Macro versus Function */ | |
#include <stdio.h> | |
#pragma warning(disable : 4996) | |
#define mac(a,b) a*a + b*b - 2*a*b | |
int func(int a, int b) { | |
return (a*a + b*b - 2 * a*b); | |
} |
This file contains 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
Scanner in = new Scanner(System.in); | |
String input = ""; | |
int nonLetters; | |
boolean hasNonLetters = false; | |
while(!hasNonLetters) { | |
nonLetters = 0; | |
System.out.println("Please enter a valid input"); | |
input = in.next(); | |
for (int i = 0; i < input.length(); i++) { | |