Every raspberry pi, from Zero, Zero W, Zero 2 (great name guys), Pi 1, Pi 2, Pi 3, Pi 4, Pi 5 and every variation are all general purpose linux computers that can run pretty much any code you can run on a normal linux computer. They are all the same compilation target IIRC. If you wrote a program for the original Pi, you could have run it on every other Pi without modification or recompilation, depending on peripheral specifics I guess.
Are you getting confused by the 2040?