Posts

Showing posts from January, 2019

C Programming: Superb E-Book from beginner to expert [C career semi retired]

Image
I developed C Programming in Unix/Linux/Embed around 7 years. Therefore , I made a decision to learn emerging p rogramming language. Here is C Programming bible from beginner to expert. *** If you have any questions or advice *** **Please feel free to comment it since I don't know everything** Learn  C the hard way.   It's PDF file size 25MB and 637 pages It's a paid version on official website. if you want it for educational purpose, please email to me. Complete ly F REE!!! Thank you so much from THAILAND

C Programming: Solve Math question with C Programming

Image
Objective of this post : A guy from C community asked me to find using numbers with conditio n so I suggest ed  him as code snippet below since it can be reused or enhanced..  == My suggestion is == #include <stdio.h> void vdSumA_incrementbyB_notGreaterthanC ( int iArgInitial, int iArgIncrementPertime,  int iArgNotgreaterThan) {     int iInitial=iArgInitial, iIncreasePertime=iArgIncrementPertime, iSumOf_a_to_b=iArgInitial;     int iCount=0;     for ( iSumOf_a_to_b ; iSumOf_a_to_b+iIncreasePertime <= iArgNotgreaterThan ; (iSumOf_a_to_b+=iIncreasePertime)  )     {         // uncomment it to see using number           // printf ("%d + %d = %d\n",iSumOf_a_to_b, iIncreasePertime, iSumOf_a_to_b+iIncreasePertime);         iCount++;     }      printf ("Init...

C Programming: Preprocessor Directives in C -> define Macro section

Image
All Preprocessor directives Objective of this post: How to define Macro? single line, multiple lines? Where can we define it? Syntax and  explaination:               Single line : https://www.techonthenet.com/c_language/constants/create_define.php             Multiple lines : https://docs.microsoft.com/en-us/cpp/preprocessor/hash-define-directive-c-cpp?view=vs-2017             == 1. To  define single and multiple lines Macro   from  online so urce   == # include <stdio.h> #define NUMNER_PER_LINE 10  // To define single line /* Below is to define multiple lines */ # define PRINT_A_to_B(A, B) \    { \      int a=A, b=B, counterNumber=1; \      printf ("\nFrom=%d to %d have shown as below\n",a,b); \ ...

C Programming: How to improve C to support more Array N dimensions

Image
Objective of this post : To change array 2 dimensions to support more requirements by using structure Syntax:       Please find its well-explained syntax at below link:       https://www.tutorialspoint.com/cprogramming/c_structures.htm Sample from C community: A guy from C community asked me to write another code. Here is his code snippet /* This code from C community N students with math and algo marks.     If math > 70 and algo > 50 then pass, otherwise fail. This simple C program with 2D ARRAY. */    // Compiler version gcc 6.3.0 #include <stdio.h> int main(void) {       int n,i,j;       int mark[n][2];              printf ("enter the no of students");       scanf ("%d",&n);         printf ("\n enter math and algo mark...

C Programming: Variable Argument with deep explaination

Image
Objective of this post: To explain clearly what Variable Argument in <stdarg.h> can do. Syntax:               Please find its explanation at below link:              https://www.tutorialspoint.com/cprogramming/c_variable_arguments.htm Sample 1: Sample from tutorialspoint.com                       #include < stdio.h >   #include < stdarg.h >   double average ( int num ,...)   {          /* initialize valist for number of arguments */        va_list valist ;          double sum = 0.0 ;           int i ;          /* access all the ...