Page 2 of 6 FirstFirst 12345 ... LastLast
Results 11 to 20 of 54
  1. #11
    C.I.A. Sarevok's Avatar
    Join Date
    Apr 2007
    Gender
    Male
    Posts
    2,802
    Blog Entries
    4

    Quote Originally Posted by simoncpu View Post
    Waaaaah... mo crash na sa Linux, command na sa fork bomb... I didn't thought nga padanganon nimo... hehe... di na ko mag paste2x ug evil Linux commands maka sala nya ko... =)
    hahaha mao diay. oks ra kay virtual machine ra man to ako gigamit

    karon pa ko kabantay. colon ( : ) diay ang function name ana hahaha bugoya recursive man diay
    Last edited by Sarevok; 05-16-2014 at 03:38 PM.

  2. #12
    C.I.A. Sarevok's Avatar
    Join Date
    Apr 2007
    Gender
    Male
    Posts
    2,802
    Blog Entries
    4
    [Programming Language]
    C++

    [Question]
    Print "Hello World!" in the console without using a semicolon
    Code:
    ;
    in your code.

  3. #13
    Quote Originally Posted by Sarevok View Post
    [Programming Language]
    C++

    [Question]
    Print "Hello World!" in the console without using a semicolon
    Code:
    ;
    in your code.
    Code:
    #include <cstdio>
    
    int main()
    {
        while (!printf("Hello world!")) { }
    }
    Pwede sad if statement

  4. #14
    C.I.A. cliff_drew's Avatar
    Join Date
    Oct 2008
    Gender
    Male
    Posts
    4,571
    Blog Entries
    2
    OT: Bugoya sa fork bomb

  5. #15
    C.I.A. Sarevok's Avatar
    Join Date
    Apr 2007
    Gender
    Male
    Posts
    2,802
    Blog Entries
    4
    [Programming Language]
    C using gcc compiler

    [QUESTION]
    How can you make this code print gvar as 666 without editing the main function?
    Code:
    #include <stdio.h>
    
    void func(void); 
    
    int gvar = 0;
    
    int main(void)
    {
        printf("In main. gvar=%d\n", gvar);
        return 1;
    }
    
    void func(void)
    {
        gvar = 666;
    }

  6. #16
    Quote Originally Posted by Sarevok View Post
    [Programming Language]
    C using gcc compiler

    [QUESTION]
    How can you make this code print gvar as 666 without editing the main function?
    Code:
    #include <stdio.h>
    
    void func(void); 
    
    int gvar = 0;
    
    int main(void)
    {
        printf("In main. gvar=%d\n", gvar);
        return 1;
    }
    
    void func(void)
    {
        gvar = 666;
    }
    Ladies and gentlemen, I present to you a solution that doesn't involve editing the file at all:
    Code:
    simoncpu@simoncpu ~ $ gcc -D'gvar=gvar=666,x' saverok.c -o saverok
    simoncpu@simoncpu ~ $ ./saverok 
    In main. gvar=666
    This works because the preprocesssor expands the code to:
    Code:
    void func(void);
    
    int gvar=666,x = 0;
    
    int main(void)
    {
        printf("In main. gvar=%d\n", gvar=666,x);
        return 1;
    }
    
    void func(void)
    {
        gvar=666,x = 666;
    }

  7. #17
    C.I.A. Sarevok's Avatar
    Join Date
    Apr 2007
    Gender
    Male
    Posts
    2,802
    Blog Entries
    4
    Quote Originally Posted by simoncpu View Post
    Ladies and gentlemen, I present to you a solution that doesn't involve editing the file at all:
    Code:
    simoncpu@simoncpu ~ $ gcc -D'gvar=gvar=666,x' saverok.c -o saverok
    simoncpu@simoncpu ~ $ ./saverok 
    In main. gvar=666
    This works because the preprocesssor expands the code to:
    Code:
    void func(void);
    
    int gvar=666,x = 0;
    
    int main(void)
    {
        printf("In main. gvar=%d\n", gvar=666,x);
        return 1;
    }
    
    void func(void)
    {
        gvar=666,x = 666;
    }
    didn't see that coming

    minblown ko da hahaha unsa meaning sa -D option sa gcc? ireplace niya tanan variable or sa global variables ra na muwork?

    EDIT: ahaka gitry nako sa local variable, iya man gihapon gireplace so much for security lol
    Last edited by Sarevok; 05-22-2014 at 10:26 AM.

  8. #18
    C.I.A. Sarevok's Avatar
    Join Date
    Apr 2007
    Gender
    Male
    Posts
    2,802
    Blog Entries
    4
    nakit-an ra jud nako ang meaning. pangdebug diay

    Code:
     -D name=definition
               The contents of definition are tokenized and processed as if they
               appeared during translation phase three in a #define directive.  In
               particular, the definition will be truncated by embedded newline
               characters.
    
               If you are invoking the preprocessor from a shell or shell-like
               program you may need to use the shell's quoting syntax to protect
               characters such as spaces that have a meaning in the shell syntax.
    
               If you wish to define a function-like macro on the command line, write
               its argument list with surrounding parentheses before the equals sign
               (if any).  Parentheses are meaningful to most shells, so you will need
               to quote the option.  With sh and csh, -D'name(args...)=definition'
               works.
    
               -D and -U options are processed in the order they are given on the
               command line.  All -imacros file and -include file options are
               processed after all -D and -U options.

  9. #19
    Yepp, pwede ka maka-define ug macro using the command line. Bale, gi-himo nako nga macro ang "gvar" to redefine it to something else... I think ang Visual Studio pwede sad... hehe...

  10. #20
    C.I.A. Sarevok's Avatar
    Join Date
    Apr 2007
    Gender
    Male
    Posts
    2,802
    Blog Entries
    4
    before ko magpost ug new question kay ako sa ipakita ang lain na answer sa ako previous question

    Ichange ra nimo ang pagdeclare sa function into:
    Code:
    void func(void) __attribute__ ((constructor));

    mangita sa ko new tricks

  11.    Advertisement

Page 2 of 6 FirstFirst 12345 ... LastLast

Similar Threads

 
  1. what is your favorite programming language?
    By sachem in forum Programming
    Replies: 310
    Last Post: 10-08-2015, 03:11 PM
  2. Python programming questions
    By Louis in forum Programming
    Replies: 8
    Last Post: 09-10-2014, 10:51 AM
  3. Beware of 'tricked out' Hijack program
    By cliff_drew in forum Software & Games (Old)
    Replies: 4
    Last Post: 06-24-2009, 02:38 PM
  4. Boot using USB w/ different programs (question)
    By babolgam in forum Computer Hardware
    Replies: 5
    Last Post: 01-22-2009, 11:17 AM
  5. question on networking programming
    By poymode in forum Programming
    Replies: 6
    Last Post: 12-29-2008, 08:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top