Programming Tips 💡
54.5K subscribers
65 photos
8 videos
30 files
338 links
Programming:
Tips 💡
Articles 📕
Resources 👾
Design Patterns 💎
Software Principles

🇳🇱 Contact & Ads: @MoienTajik
Download Telegram
Media is too big
VIEW IN TELEGRAM
آموزش الگو طراحی Repository و Unit Of Work بصورت Generic در #C

#DesignPatterns #OOP
@ProgrammingTip
📦 Macro To Get Array Size Of Any Data Type In C 📦

The following macro will help you in getting the size of an array of any data type. It works by dividing the length of the array to the size of its field. 💡

Code:
#define num(x) (sizeof (x) / sizeof (*x)) 

int _tmain() {
int numbers[10] =
{1,1,1,1,1,1};

char *chars[20] =
{"","","","","","","","",""};

printf("Size of numbers[10] is %d\n",
num(numbers));

printf("Size of chars[20] is %d\n",
num(chars));
}



Output:
  Size of numbers[10] is 10 

  Size of chars[20] is 20  

  Press any key to continue . . .


#c #cpp #array
@ProgrammingTip
Add Any Numbers Without “+” Operator In C

Bitwise operators can be used to perform the addition (+) operation as mentioned in below example 🔆

int Add(int x, int y)
{
if (y == 0)
return x;
else
return Add( x ^ y, (x & y) << 1);
}




#c #cpp #operator
@ProgrammingTip
👉 Pointer Tips In C & C++ 👈

🔸Never ever forget to initialize the pointer. This may be simple and easy known stuff but here I would like to add it as an embedded system developer that this was the main cause of many bugs.

🔹Also never change the pointer variable itself unless & until you need to change the pointer.

🔸Also monitor that the pointers are not overlapping if not pointing to same memory location range.



#c #cpp #pointer
@ProgrammingTip
CLion : A cross-platform IDE for C and C++ 🦁

Thanks to native C and C++ support, including C++11 and C++14, libc++ and Boost, CLion knows your code through and through and takes care of the routine while you focus on the important things.

https://t.me/pgimg/14
[ Website ]: https://www.jetbrains.com/clion


#ide #c #cpp
@ProgrammingTip