Code Monkey home page Code Monkey logo

Comments (4)

joshcangit avatar joshcangit commented on June 2, 2024

It converts the first argument, an integer, into 8 bit binary.
Numbers 0 and 256 convert to 00000000.
Negative numbers convert to 11111111.

Executing without arguments will give a Segmentation fault (core dumped) error.
Compilation generates a warning, which can be ignored.

prog.c:1:68: warning: unsafe pointer arithmetic [-Wunsafe-buffer-usage]
    1 | int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
      |                                                                    ^
1 warning generated.

from fh-250-puzzles.

tanyyyming avatar tanyyyming commented on June 2, 2024

It converts a non-negative integer x to the binary representation of x % 256.
It converts a negative integer to 11111111
It converts an integer and any character separated with whitespace (e.g. ./prog 3 randomstuff) to 30"31331

from fh-250-puzzles.

sg-incognito avatar sg-incognito commented on June 2, 2024

image

With a non-zero argument input, the code returns 8 characters, based on the flow seen in the image.

With zero arguments, it throws a segmentation fault.

argc represents the number of arguments passed to the program. atoi(argv[1]) converts the argument (string) to an integer

from fh-250-puzzles.

parth-io avatar parth-io commented on June 2, 2024

Unfortunately, we could not figure this out too.

There are some hints here that emphasise certain binary operations.

There is a trace of the math here.

from fh-250-puzzles.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.