iSTORYA.NET

Go Back   iSTORYA.NET > Science & Technology > Software & Games > Programming
: :

Register FAQ Members List Calendar Mark Forums Read

Programming :: Programming related discussions ::

Reply
LinkBack Thread Tools
  #1  
Old 08-02-2005, 01:10 AM
Junior Member
darkhero is offline
darkhero's Avatar
Join Date: Jul 2005
Gender: Male
Posts: 212
Default C Puzzle (bag o)

unsa may output ani heheheeh way tikasay ha...
Code:
void f(int, int);

main()
{
Â* int x = 5;
Â* printf("x : %d \t\t %d\n", x++, ++x);
Â* f(x, x++);
}

void f(int x, int y)
{
Â* printf("f : x = %d \t y = %d\n", x, y);
}
gihimoan nalang nako ug lain nga thread ni.. kay way klaro kung isumpay ra nako sa pikas thread... http://www.istorya.net/forums/index.php?topic=40930.0 take note ha wala pay nakatubag ani so far.. lisod tingali ni kaau lol
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 08-02-2005, 07:34 PM
Junior Member
gloryhunter is offline
Join Date: May 2005
Posts: 310
Default Re: C Puzzle (bag o)

postincrement and preincrement exercise.


void f(int, int);

main()
{
int x = 5;
printf("x : %d \t\t %d\n", x++, ++x); // ang outpuit ani is x: 6 6
// x is now 7, because it's postincremented by 1
f(x, x++); // C evaluates the left param first, then postincremented
}

void f(int x, int y)
{
printf("f : x = %d \t y = %d\n", x, y); // y = 7, since it's postincrementedm x:8
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 08-03-2005, 01:18 AM
Junior Member
darkhero is offline
darkhero's Avatar
Join Date: Jul 2005
Gender: Male
Posts: 212
Default Re: C Puzzle (bag o)

Quote:
Originally Posted by gloryhunter
postincrement and preincrement exercise.


void f(int, int);

main()
{
Â* int x = 5;
Â* printf("x : %d \t\t %d\n", x++, ++x); // ang outpuit ani is x: 6Â* 6
Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* // x is now 7, because it's postincremented by 1
Â* f(x, x++);Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â*// C evaluates the left param first, then postincremented
}

void f(int x, int y)
{
Â* printf("f : x = %d \t y = %d\n", x, y); // y = 7,Â* since it's postincrementedm x:8
}
so meaning.. mao ni ang output:
Code:
x : 6Â* Â* Â* Â* Â* Â* 6
f : x = 8Â* Â* Â* Â* y = 7
hhehe ok sakto.. maayo pagka comment pre.. pero naay kuwang... 50% pasar..!

take note, mga pre.. sayon nalang ha.. gi answeran na ni gloryhunter ang katunga sa puzzle.. heheh (o ha hint na to ha)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 08-06-2005, 11:25 AM
Elite Member
HybernaTe is offline
HybernaTe's Avatar
Join Date: Apr 2004
Posts: 1,064
Default Re: C Puzzle (bag o)

bumping! anyone?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 08-10-2005, 10:07 AM
Senior Member
Archie is offline
Join Date: Aug 2004
Posts: 572
Default Re: C Puzzle (bag o)

ni answer ko ani sa pikas... sayop ako... noob man gud!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 08-10-2005, 01:39 PM
Junior Member
red_colt is offline
Join Date: Jul 2005
Posts: 124
Default Re: C Puzzle (bag o)

6, 6
7, 8


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 08-11-2005, 11:26 PM
Elite Member
silent-kill is offline
silent-kill's Avatar
Join Date: Mar 2003
Gender: Male
Posts: 1,795
Default Re: C Puzzle (bag o)

kani beh hehe
#include<iostream>
using namespace std
main() {

cout << "hello Garci";

}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 08-13-2005, 05:38 AM
Newbie
daywalker is offline
Join Date: Jan 2005
Posts: 20
Default Re: C Puzzle (bag o)


x: 5 7
f: 7 7


mao ni akng answer sa pikas.. hehehehe




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9  
Old 08-13-2005, 01:08 PM
Junior Member
red_colt is offline
Join Date: Jul 2005
Posts: 124
Default Re: C Puzzle (bag o)

Quote:
Originally Posted by silent-kill
kani beh hehe
#include<iostream>
using namespace std
main() {

cout << "hello Garci";

}
nsa may nakalisod ana?

print ra mana sa console ug hello Garci
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10  
Old 08-14-2005, 12:49 PM
Elite Member
silent-kill is offline
silent-kill's Avatar
Join Date: Mar 2003
Gender: Male
Posts: 1,795
Default Re: C Puzzle (bag o)

ni ingon diay ko lisod?, anyways i was just kidding around..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11  
Old 08-15-2005, 06:49 PM
Junior Member
red_colt is offline
Join Date: Jul 2005
Posts: 124
Default Re: C Puzzle (bag o)

gamit C

print imo name using an empty main function (way sulod ang main!! na function)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12  
Old 08-16-2005, 10:47 AM
Junior Member
gloryhunter is offline
Join Date: May 2005
Posts: 310
Default Re: C Puzzle (bag o)

Quote:
Originally Posted by red_colt
gamit C

print imo name using an empty main function (way sulod ang main!! na function)
#include <stdio.h>

void ehem (void) __attribute__ ((constructor));

// empty main method
main()
{

}

void ehem (void)
{
printf ("gloryhound");
}


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13  
Old 08-17-2005, 08:02 AM
Junior Member
darkhero is offline
darkhero's Avatar
Join Date: Jul 2005
Gender: Male
Posts: 212
Default Re: C Puzzle (bag o)

Quote:
Originally Posted by daywalker

x: 5Â* Â* Â* Â* 7
f:Â* 7Â* Â* Â* Â* 7


mao ni akng answer sa pikas.. hehehehe
nice... na answer na ang katunga sa puzzle... si gloryhunter ra ug si daywalker ang nakakuha sa solusyon..

ang solusyon ani nga puzzle nag depende kung gi unsa pag implement ang stack. depende sa operating system.. ang uban machines... gi process ang stack from left to right.. nya ang uban from right to left....

that's why duha ang solusyon sa puzzle....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +8. The time now is 08:34 AM.


Powered by vBulletin® Version 3.7.6
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
(c) 2002-2009 iSTORYA.NET | Design by DrE | Modifications by BeoR