[Solved] A short C++ program about the pointer

An array of arrays like yours look like this in memory +———+———+———+———+———+———+ | x[0][0] | x[0][1] | x[0][2] | x[1][0] | x[1][1] | x[1][2] | +———+———+———+———+———+———+ The location of x, x[0] and x[0][0] is all the same. Also, arrays naturally decays to pointers to their first element. If you use plain x you will get … Read more

[Solved] Cannot figure out why my code is not working [closed]

If numberOfMiles should be of type float you have to exchange the following line scanf(“%d”, &numberOfMiles); by scanf(“%f”, &numberOfMiles); or you can set the type to int. — If you want to avoid an endless loop, exchange } while (numberOfMiles > 1); by } while (numberOfMiles < 1); Btw. why not allow distances that are … Read more

[Solved] Use of . in python? [duplicate]

You use dot for 3 main reasons: Accessing members of a module: a module is simply a python file, and members can be variables, functions, classes and so on. Accessing modules within a package: a package is a directory containing a__init__ module. Some packages are nested and contain inner packages. You have to reach the … Read more