2D window example

I am new to CUDA programming and am having a hard time finding useful AND well explained examples of working with 2D images. I found this example of code that I would like to use https://bluewaters.ncsa.illinois.edu/documents/10157/63094/NCSA02a-window-example-cpp-08-14-13.pdf from an old nvidia presentation but I cannot get the code to compile. I get several errors like “error: a value of type “float *” cannot be used to initialize an entity of type “int *”” as well as several other problems like what is i and j in the CUDA C implementation?. Which is an obvious problem.

Can someone point me to where a compileable similar program exists? I usually learn much better if I am given a moderately complex example then every line’s function is described but I am having a VERY hard time finding something like that for 2D array analysis in CUDA C. Any help you cab lend would be much appreciated.