Welcome Guest ( Log In | Register)



3 Pages V  < 1 2 3 >  
Reply to this topicStart new topic
> C Code, Can U Solve This?, Another interesting problem
8bit
post Feb 1 2005, 02:08 AM
Post #11


Member [Level 2]
*****

Group: Members
Posts: 85
Joined: 27-December 04
Member No.: 2,976



CODE

void fun(void)
{
 return 0;
}


XD Who wants it to print 20 lets just end the program now!
Go to the top of the page
 
+Quote Post
osknockout
post Feb 1 2005, 02:11 AM
Post #12


Super Member
*********

Group: Members
Posts: 399
Joined: 14-November 04
From: Elysium
Member No.: 2,280



8bit, you can't do that (can have only 1 return 0;)
Cse-icons you devil, who the hell would
do that? Just playing around of course, I
didn't get it. I'm too practical laugh.gif
Go to the top of the page
 
+Quote Post
8bit
post Feb 4 2005, 01:37 AM
Post #13


Member [Level 2]
*****

Group: Members
Posts: 85
Joined: 27-December 04
Member No.: 2,976



CODE

void fun(void)
{
 int * ptr =&i;
 *ptr=50;
}


Beat that.
Go to the top of the page
 
+Quote Post
ankitunlimited
post Mar 31 2006, 07:33 AM
Post #14


Member [Level 2]
*****

Group: Members
Posts: 81
Joined: 29-March 06
From: New Delhi, India
Member No.: 20,918



QUOTE(8bit @ Feb 4 2005, 07:07 AM) *

CODE

void fun(void)
{
 int * ptr =&i;
 *ptr=50;
}


Beat that.


i dont know c, but c++. In c++, you cant access i anywhere else but main()
Go to the top of the page
 
+Quote Post
fotomaniak
post Apr 23 2006, 03:21 AM
Post #15


Newbie
*

Group: Members
Posts: 1
Joined: 23-April 06
Member No.: 22,313



void fun()
{
int i=0;
while(true) i++;
}
overflow and program will end... or user will kill the program after waiting for a bit.

--------------------------------
void fun()
{
int *i=0;
while(true) *(i++)=i;
}
same as above plus there is a chance that program corrupts some critical data and crashes


Go to the top of the page
 
+Quote Post
WindAndWater
post Apr 23 2006, 06:09 PM
Post #16


Advanced Member
*******

Group: Members
Posts: 106
Joined: 1-April 06
Member No.: 21,148



QUOTE(cse-icons @ Nov 17 2004, 03:07 AM) *
How do I manipulate and change the value of i?


Technically you aren't changing the value of i -- you're defining a new i (it's at a new memory address). To answer your puzzle, you can change the value of i using an ASM injection attack using a noop sled to compensate for the variance in memory allocation addresses.
Go to the top of the page
 
+Quote Post
iGuest
post Dec 13 2007, 03:53 AM
Post #17


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



Need help... Need a program on turbo see (the theme is christmas)... Newbie at turbo see...
Go to the top of the page
 
+Quote Post
omarsdali
post Dec 13 2007, 06:39 AM
Post #18


Member [Level 1]
****

Group: Members
Posts: 74
Joined: 2-June 07
Member No.: 44,080



QUOTE
8bit, you can't do that (can have only 1 return 0;)


The reason why he can't do it is because the return type is void, but if it was int like this:

int fun(void)
{

}

then he can do it.
Go to the top of the page
 
+Quote Post
Csshih
post Dec 13 2007, 06:12 PM
Post #19


Premium Member
********

Group: [HOSTED]
Posts: 190
Joined: 20-April 06
From: from the Dumpster in the back
Member No.: 22,158



Oh yea?
void fun(void)
{
randomlineofetext(3249830325)
}
the program won't print anything at all xD
Go to the top of the page
 
+Quote Post
klusk