Follow us on Twitter!
It is the path of least resistance that makes rivers and men crooked. - Bj Palmer
Wednesday, April 23, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 22
Guests Online: 18
Members Online: 4

Registered Members: 82877
Newest Member: MWiki
Latest Articles
View Thread

HellBound Hackers | HellBound Hackers | Questions

Author

I'm new to programming in C.


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 27-06-08 07:54
I took most of this from a book and tryed to add my own code to see if I could get it to work. int y doesn't print 120 and I'm not too sure why. I don't want the answer I would like hits on what I did wrong.


Code

#include <stdio.h> /* standard i/o include file*/

struct xampl {       
  int x;
  int y;
};

int main()

    struct xampl structure;
    struct xampl *ptr;
    struct xampl y;

    structure.x = 12;
    structure.y = 120;
   
    ptr = &structure; 
   
    printf( "%d\n", ptr->x );  /* The -> acts somewhat like the * But it gets what is at that memory address*/
    printf("%d\n", y); 
   
   
    getchar();
    return 0;
}



Author

RE: I'm new to programming in C.


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 27-06-08 08:08
// printf("%d\n", y);
this is wrong !
it should be printf("%d\n",structure.y);
use the structure variable
Author

RE: I'm new to programming in C.


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 27-06-08 08:10
TweakedEh wrote:
I don't want the answer I would like hits on what I did wrong.


Thanks for the help but I wouldn't mind a hint next time Wink
Author

RE: I'm new to programming in C.

Uber0n
Member



Posts: 1963
Location: Sweden‭‮
Joined: 13.06.06
Rank:
Hacker Level 3
Posted on 27-06-08 11:43
So you can't code in C but you don't want people to tell you exactly what's wrong with your code...? :right:


img230.imageshack.us/img230/724/uber0nsig3hj6.gif
http://uber0n.web. . .
Nope http://uber0n.webs.com/
Author

RE: I'm new to programming in C.


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 27-06-08 11:49
...dude.... Thats fucking annoying, your being ignorant and unclear. Why dont you bury your computer in Egypt and try to shove a pyramid up your ass cuz thats about all your 'intellectual' mind will be able to comprehend.
Nah jk haha. Just don't be so annoying, consider yourself mildly chastised/flamed.


Author

RE: I'm new to programming in C.


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 27-06-08 18:52
Uber0n wrote:
So you can't code in C but you don't want people to tell you exactly what's wrong with your code...? :right:


No, I can code in C but not a lot. I'm still learning and couldn't find my mistake. I have a book here that I am reading, I added some of my own code to that to have a better understaning of what it does and how it works. I asked for a hint because I don't like being spoon fed.