Skip to content

Instantly share code, notes, and snippets.

@winhtut
Last active November 2, 2019 16:41
Show Gist options
  • Save winhtut/1adede03ec9911a80efe8f251c55eb08 to your computer and use it in GitHub Desktop.
Save winhtut/1adede03ec9911a80efe8f251c55eb08 to your computer and use it in GitHub Desktop.
C for Geeks
#include<iostream>
#include<conio.h>
#include<stdio.h>
using namespace std;
void fun(int kkk[])
{
int i;
int* f_ptr = &kkk[0];
int* final_ptr = &kkk[3];
int difAddress = final_ptr - f_ptr;
printf_s("address of final kkk[0] : %d\n", final_ptr);
printf_s("address of first kkk[1] : %d\n", f_ptr);
printf_s("\n\ndifference aadderss %d\n", difAddress);
printf_s("sizeof (kkk):%d\n", sizeof(kkk));
int arr_size = sizeof(kkk) / sizeof(*kkk);
printf_s("%d\n", sizeof(kkk[0]));
int z = 0;
for (z = 0; z < 5; z++) {
printf_s("%d first place %d size of kkk[%d]\n", z, kkk[z],sizeof(z));
}
for (i = 0; i < arr_size; i++)
printf_s("%d ", kkk[i]);
}
int main()
{
int i;
int zzz[4] = {10,2,1,1};
printf_s("size of zzz arr %d\n", sizeof(zzz));
int arr[4] = { 10, 20 ,30, 40 };
fun(arr);
return 0;
}
#include<stdio.h>
#include<conio.h>
void f(int* p, int* q)
{
p = q;
*p = 3;
printf_s("%d .. %d\n", p, q);
printf_s("%d .. %d\n", *p, *q);
}
int i = 1, j = 2;
int main()
{
f(&i, &j);
printf_s("%d %d ", i, j);
getchar();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment