Donate to us via Paypal!
Capitalism is an Island of wealth in a sea of poverty
Monday, March 01, 2021
Navigation
Home
 Find:
 Information:
Learn
Communicate
Submit
Shop
Challenges
 Exploit:
 Programming:
 Think:
 Track:
 Patch:
 Other:
 Need Help?
Other
Members Online
Total Online: 117
Guests Online: 116
Members Online: 1

Registered Members: 133766
Newest Member: denim6321d
Latest Articles

View Thread

HellBound Hackers | Computer General | Programming

Author

C Add Function

Scar0ptics
Member



Posts: 229
Location: ∆ P®0X¥ W0R|D ∆
Joined: 19.11.13
Rank:
Mad User
Posted on 16-11-16 00:49
I created a file within a Linux OS and used Nano to create the file. I named this file "Add.c" and compiled it by using "g++". I know some people may prefer other text editors, and that's fine.

1.) Create an AddOne function so that it correctly adds one to the value of x and prints:

X: 0
X: 1

#include <stdio.h>


int main(int argc, char ** argv){
int x = 0;
printf("X: %d \n", x);

// put solution here

printf("X: %d \n", x);
}
overlay-network.ddns.net
Author

RE: Solution

Scar0ptics
Member



Posts: 229
Location: ∆ P®0X¥ W0R|D ∆
Joined: 19.11.13
Rank:
Mad User
Posted on 16-11-16 00:54
void Addone (int *x) {
*x = *x+1;

}


// I understand that there are other ways of doing this and I am open to all constructive criticism, but before you comment please consider that this code is written so the built-in Linux compiler (g++) can understand it.
overlay-network.ddns.net
Author

RE: C Add Function

_spartax_
Member



Posts: 33
Location: SYSTEM
Joined: 03.06.16
Rank:
HBH Guru
Posted on 16-11-16 03:48
#include <stdio.h>

void inc(int*);

int main(int argc, char const* argv[])
{
int foo = 0xDEAD;
printf("%x\n", foo);
inc(&foo);
printf("%x\n", foo);
return 0;
}

void inc(int* x)
{
asm volatile("incl (%rdi)"Wink;
}


Author

RE: C Add Function

Scar0ptics
Member



Posts: 229
Location: ∆ P®0X¥ W0R|D ∆
Joined: 19.11.13
Rank:
Mad User
Posted on 16-11-16 13:22
you got a smiley in your code man.
overlay-network.ddns.net