Built In Macros in C Programming

https://youtu.be/PKsL4tt-8uw #include <stdio.h> void some_function() { printf("Name of the function is %s\n", __func__); } int main() { printf("Line number is %d\n", __LINE__); printf("The file name is %s\n", __FILE__); some_function(); return…

The #ifndef directive in C

https://youtu.be/wM6HLwOfML8?si=ieNeTqV7ry0TomTU #include <stdio.h> #define SOME_MACRO int main() { #ifndef SOME_MACRO printf("Will not compiled\n"); #endif #ifndef NO_MACRO printf("This one will be printed\n"); #endif #ifndef NEW_MACRO #define NEW_MACRO printf("Macro defined\n"); #endif return…

The #ifdef directive in C

https://youtu.be/H0-FR6ozhOc?si=zl88UVu1wYhQYYDJ #include <stdio.h> #define OUR_MACRO int main() { #ifdef OUR_MACRO printf("Will get compiled!\n"); #endif #ifdef NO_MACRO printf("Will not get compiled\n"); #endif return 0; }

#undef directive in C

https://youtu.be/P9hQr1G1ebA?si=2G1Emg812xikkzWX #include <stdio.h> #define MAX 150 int main() { int i = MAX; printf("MAX value is : %d\n",MAX); #undef MAX printf("MAX no longer exists!"); #define MAX 500 printf("MAX exists again\n");…

Person structure in C Programming

https://youtu.be/Mwo03kcdkiQ?si=Ad64uSKML5ird64v #include <stdio.h> struct Person { char *name; int age; double p_salary; }; int main() { struct Person p; p.name ="Mike"; p.age = 35; p.p_salary = 55000.00; printf("Name: %s\n",p.name); printf("Age:…

Function Pointers in C

https://youtu.be/5kP7xofoUtE?si=v0BLjq2h5XOrOEGG #include <stdio.h> void somefunction(int x, int y){ printf("%d\n",x+y); } int main() { void (*sf)(int, int); sf = somefunction; sf(5,6); return 0; }

Typedef in C

The typedef declaration. https://youtu.be/ydy3JzlXdkc #include <stdio.h> typedef int MyInt; typedef char* MyString; int main() { MyInt i = 150; MyString ms = "Hello World"; printf("The value is = %d\n",i); printf("The…

structure as a function argument

How to use structure as a function argument. https://youtu.be/hplWXRDSNDc?si=u_d7SvPwepdVUnHN #include <stdio.h> struct MyStruct { char a; int i; }; struct MyStruct some_function(char b, int x){ struct MyStruct tmp; tmp.a =…