Profile cover photo
Profile photo
Kapil Thakar
77 followers
77 followers
About
Kapil's posts

Post has attachment

Post has attachment

Post has attachment
What is difference between static const and const in C with Example Code
#include "stdafx.h" #include <stdio.h> #include <conio.h> int testa =  100; int testb =  101; int test() {        if(testa > testb)         return 0;     else         return 1; } int _tmain(int argc, _TCHAR* argv[]) {     for(int k=0; k<5; k++)     {       ...

Post has attachment
How to Find Max & Min of Two Numbers without using Conditional Operator in C
#include "stdafx.h" #include <stdio.h> #include <conio.h> int clearMSBthroughI(int num, int i) {     int mask = (1 << i) - 1;     return num & mask; } // To clear all bits from i through 0 (inclusive), we do: int clearBitsIthrough0(int num, int i) {     int...

Post has attachment
How do I reverse the Interger Number in C with Example Code
#include "stdafx.h" #include <conio.h> #include "stdlib.h" #include "stdio.h" #include "string.h" int reverseInt(int num) {     int rnum = 0;     printf("%d\n", num);       while(0 != num){         rnum = (rnum * 10) + (num % 10);           num = num / 10; ...

Post has attachment
How to Concat Two String without Using strcat library function in C?
You can take Two String using either:   char *str1 = "Kapil";   char *str2 = "Thakar"; or   char str1[] = "Kapil";   char str2[] = "Thakar"; Now to concat these two string you need to create another string or you can use the same string. Here I have taken a...

Post has attachment
What is Segmentation fault in C? How to Solve it?
This is the most common error for beginners. I would like to give an example to demonstrate about segmentation fault. To define a string you can use: char *str = "Constant String"; #include <stdio.h> #include <stdlib.h> #include <conio.h> int main() { char ...

Post has attachment
What is difference between Process and Thread?
Thread vs Process Thread is the subset of Process. A process can contain many threads in it. Thread share the memory address space & other resources which are allotted to the process by Kernel. Thread will share file descriptor The thread will share file sy...

Post has attachment
How do I remove Space from Given String in C with example Code
#include <stdio.h> #include <conio.h> #include <string.h> #include <stdlib.h> int main() { char testString[] = "Kapil Thakar"; char *outString = (char *) malloc (sizeof(testString)); int i = 0; for(i=0 ; i<strlen(testString); i++) {   if ( *(testString + i)...

Post has attachment
How to Count Number of 1's in Given Number in C
#include <stdio.h> #include <conio.h> #include <string.h> #include <stdlib.h> //Count number of one in given number int fun_bitCount(int num) { char bitCount = 0; int testBit = 0; for(int j=1; j<num; j = j << 1) { testBit = num & j; if(testBit) { bitCount++...
Wait while more posts are being loaded