#include <stdio.h>
void func1(int dynArray[]) {
printf("func1: dynArray = %p, &dynArray[0] = %p, dynArray[0] = %d\n", dynArray
, &dynArray
[0], dynArray
[0]); }
void func2(int* intPtr) {
printf("func2: intPtr = %p, &intPtr[0] = %p, intPtr[0] = %d\n", intPtr
, &intPtr
[0], intPtr
[0]); }
void func3(int intVal) {
printf("func3: intVal = %d, &intValue = %p\n", intVal
, &intVal
); }
int main() {
int mainArray[3] = { 1, 2, 3 };
int mainInt = 10;
printf("mainArray = %p, &mainArray[0] = %p, mainArray[0] = %d\n", mainArray
, &mainArray
, mainArray
[0]); func1(mainArray);
func2(mainArray);
printf("mainInt = %d, &mainInt = %p\n", mainInt
, &mainInt
); func3(mainInt);
return 0;
}
ICAgICNpbmNsdWRlIDxzdGRpby5oPgoKICAgIHZvaWQgZnVuYzEoaW50IGR5bkFycmF5W10pIHsKICAgICAgICBwcmludGYoImZ1bmMxOiBkeW5BcnJheSA9ICVwLCAmZHluQXJyYXlbMF0gPSAlcCwgZHluQXJyYXlbMF0gPSAlZFxuIiwgZHluQXJyYXksICZkeW5BcnJheVswXSwgZHluQXJyYXlbMF0pOwogICAgfQoKICAgIHZvaWQgZnVuYzIoaW50KiBpbnRQdHIpIHsKICAgICAgICBwcmludGYoImZ1bmMyOiBpbnRQdHIgPSAlcCwgJmludFB0clswXSA9ICVwLCBpbnRQdHJbMF0gPSAlZFxuIiwgaW50UHRyLCAmaW50UHRyWzBdLCBpbnRQdHJbMF0pOwogICAgfQoKICAgIHZvaWQgZnVuYzMoaW50IGludFZhbCkgewogICAgICAgIHByaW50ZigiZnVuYzM6IGludFZhbCA9ICVkLCAmaW50VmFsdWUgPSAlcFxuIiwgaW50VmFsLCAmaW50VmFsKTsKICAgIH0KCiAgICBpbnQgbWFpbigpIHsKICAgICAgICBpbnQgbWFpbkFycmF5WzNdID0geyAxLCAyLCAzIH07CiAgICAgICAgaW50IG1haW5JbnQgPSAxMDsKCiAgICAgICAgcHJpbnRmKCJtYWluQXJyYXkgPSAlcCwgJm1haW5BcnJheVswXSA9ICVwLCBtYWluQXJyYXlbMF0gPSAlZFxuIiwgbWFpbkFycmF5LCAmbWFpbkFycmF5LCBtYWluQXJyYXlbMF0pOwogICAgICAgIGZ1bmMxKG1haW5BcnJheSk7CiAgICAgICAgZnVuYzIobWFpbkFycmF5KTsKICAgICAgICBwcmludGYoIm1haW5JbnQgPSAlZCwgJm1haW5JbnQgPSAlcFxuIiwgbWFpbkludCwgJm1haW5JbnQpOwogICAgICAgIGZ1bmMzKG1haW5JbnQpOwoKICAgICAgICByZXR1cm4gMDsKICAgIH0=
mainArray = 0xbf806ad4, &mainArray[0] = 0xbf806ad4, mainArray[0] = 1
func1: dynArray = 0xbf806ad4, &dynArray[0] = 0xbf806ad4, dynArray[0] = 1
func2: intPtr = 0xbf806ad4, &intPtr[0] = 0xbf806ad4, intPtr[0] = 1
mainInt = 10, &mainInt = 0xbf806acc
func3: intVal = 10, &intValue = 0xbf806ad0