#include <stdio.h>
#include <stdarg.h>
// Source: https://www.tutorialspoint.com/cprogramming/c_variable_arguments.htm
double average(int num, ...) {
va_list valist;
double sum = 0.0;
int i;
/* initialize valist for num number of arguments */
va_start(valist, num);
/* access all the arguments assigned to valist */
for (i = 0; i < num; i++) {
sum += va_arg(valist, int);
}
/* clean memory reserved for valist */
va_end(valist);
return sum/num;
}
struct a_t{
};
int a(const struct a_t *param){
printf("A\n");
return 1;
}
int b(int *count){
// count == 0x100
(*count)++;
printf("b\n");
return 1;
}
int main(int argc, int **argv){
// Calculated left to right
// + / * -
// condition ? true-statement: false-statement
// == != > < <= >=
// Calculated right to left
// =
// See table: https://www.tutorialspoint.com/cprogramming/c_operators_precedence.htm
// V
// obj count int int int
// 0x100 0x100 0000 0000 0000 0000
// int arr[10];
// type(((double *) arr)+1) == int *
// int i = 0;
// int j = 0;
// // 0 + 0
// int *obj = &i; // Assume 0x100
// b(obj);
// printf("%d", /* CENCORED */);
printf("%c ", 'p' + 'z' - 'w');
}
// 001010011
// 010101001
// 011111010
// a = 0100
// b = 1110
// a2= 1010
// data = 0101011101010100101010
// mask = 1111111111111111111111
// mask = 1111111111111111111111
// 0101011101010100101010
// enctypted = data^mask
// decrypted = encrypted^mask
// a ^= b ^= a ^= b
// a_xor_b = a ^ b
// b_new = b ^ a_xor_b // Actually a
// a_new = a_xor_b ^ b_new // a_xor_b ^ a // Actually b
// c = 10 a = 15 b = 5
// -> a = 14 b = 6 c = 14/5 == 2 -> c = 3
// c = 3 a = 14 b = 6
// ->
// 3 = 011
// 6 = 110
// 010 == 2
// 6 = 0110
// 8 = 1000
// 0000
// 3 = 00000011
// 3<<3 = 00011000
Comments