Skip to content

Tag: c++

Why It is giving me Integer Overflow

Its giving me Integer Overflow both in java and C but when I tried it in Python it gave me right answer . Any reasons ? Answer There are two reasons: Most computer languages use fixed-size integers. Today, that’s often 32 bits. The correct result of your calculation, 2500000025, is a 32-bit number, mean…

Regex to match only 6letter alphanumeric words in a string

I am trying to match the 6 character word that has a combination of ONLY alphanumeric. Example String: I am currently trying regex [a-zA-Z0-9]{6} However, it matches below Output: But, what I need is only combination of alphanumeric. Something like below Desired Output Answer You may use this regex with 2 loo…

Socket binding through JNI

I try to open a socket connection on a Linux machine through JNI. If I combine Java_Socket_socket and Java_Socket_bind in same C function, the JNI call works perfectly, but it doesn’t work when I run methods sequentially. This is my code Java code Output: If I create C program from this code, and as reg…