trying to understand arrays and pointers
This commit is contained in:
1 file changed
+13
-4
+13
-4
@@ -1,8 +1,17 @@
|
||||
#include<stdio.h>
|
||||
|
||||
int* sort();
|
||||
|
||||
int main(){
|
||||
if(printf("hello, world"))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
int arr[] = {1,2,4,593,29,19,0};
|
||||
sort(arr);
|
||||
}
|
||||
|
||||
int* sort(int* arr){
|
||||
printf("`arr` is: %d\n", arr);
|
||||
printf("`*arr` is %d\n", *arr);
|
||||
printf("`&arr` is %d\n", &arr);
|
||||
printf("`arr[0]` is %d\n", arr[0]);
|
||||
// printf("`*arr[0]` is %d\n", *arr[0]); /// not possible
|
||||
printf("`&arr[0]` is %d\n", &arr[0]);
|
||||
}
|
||||
Reference in new issue
Block a user